Self teaching, cannot lock database file

M

Michael Powell

Hi,
I have been teaching myself C# and ASP, i wrote a sign-in and register
program to teach myself the use of SQL and databases using C# as the
development language.
Yesterday my little program worked a treat (except for the lack of error
handling), i came back to it today to complete it, and when i run the
program i get the following error:

Exception Details: System.Data.OleDb.OleDbException: Could not lock file.

Source Error:

Line 74:
this.oleDbCommand1.Parameters.Add("pass",OleDbType.Char).Value=this.TextBox2.Text;
Line 75: if(this.oleDbConnection1.State!=ConnectionState.Open)
Line 76: this.oleDbConnection1.Open();
Line 77: OleDbDataReader rdr=this.oleDbCommand1.ExecuteReader();
Line 78: if(rdr.HasRows)


does anyone know why this error occurs, or how to fix it.
(I don't actualy mind it not working, i just NEED to understand it!)
Any input would be most apprecciated

Mike Powell
 
H

Hans Kesting

Michael said:
Hi,
I have been teaching myself C# and ASP, i wrote a sign-in and register
program to teach myself the use of SQL and databases using C# as the
development language.
Yesterday my little program worked a treat (except for the lack of error
handling), i came back to it today to complete it, and when i run the
program i get the following error:

Exception Details: System.Data.OleDb.OleDbException: Could not lock file.

Source Error:

Line 74:
this.oleDbCommand1.Parameters.Add("pass",OleDbType.Char).Value=this.TextBox2.Text;
Line 75: if(this.oleDbConnection1.State!=ConnectionState.Open)
Line 76: this.oleDbConnection1.Open();
Line 77: OleDbDataReader rdr=this.oleDbCommand1.ExecuteReader();
Line 78: if(rdr.HasRows)


does anyone know why this error occurs, or how to fix it.
(I don't actualy mind it not working, i just NEED to understand it!)
Any input would be most apprecciated

Mike Powell

I think this happens in Access, when you have a designer open.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top