Access Database locked error
So basically im processing data to a database from a textfile. When selecting 25 or more files the database starts locking up, so in order to get all the data in the database I have to re-run over or process the files twice, can some one tell me how to get rid of this error, Im not for sure if its timing error or not
David SmithPosted Sep 28, 2010, 6:17 AM
but in code when I try to increase timeout error , i get a syntax error.
It says it cannot be assigned to because its read only, how to fix this issue
objconnection.Command.Timeout = 300;
String strConnection = Properties.Settings.Default.CLU_OpDatabaseConnectionString;
OleDbConnection objConnection = new OleDbConnection(strConnection);
objConnection.ConnectionString = strConnection;
objConnection.ConnectionTimeout = 300;
objConnection.Open();
return objConnection;
David SmithPosted Sep 28, 2010, 6:17 AM
but in code when I try to increase timeout error , i get a syntax error.
It says it cannot be assigned to because its read only, how to fix this issue
objconnection.Command.Timeout = 300;
String strConnection = Properties.Settings.Default.CLU_OpDatabaseConnectionString;
OleDbConnection objConnection = new OleDbConnection(strConnection);
objConnection.ConnectionString = strConnection;
objConnection.ConnectionTimeout = 300;
objConnection.Open();
return objConnection;
Posted Sep 27, 2010, 4:28 AM
Lemme give a sample
String strconnect = "server=Your server name;database=test;uid=stest;pwd=test";
try
{
SqlConnection con = new SqlConnection(strconnect);
con.Open();
/*-----------------------Loading the dataset---------------------*/
SqlCommand command = new SqlCommand();
command.Connection = con;
command.CommandText = "insert into test where id='1'";
command.CommandTimeout = 300;
command.ExecuteNonQuery();
con.close();
}
catch(Exception,ex)
{
Messagebox.show(ex.ToString())
}
It's just a sample...fille in ur details like database name server name,sql command u want to execute....
Hope this helps..
With Regards
P.Krishna Prasad
--------------------------------------------------------------------------------------------------------------------------
If someway my answer helped u don't forget to mark it as correct answer...
David SmithPosted Sep 27, 2010, 3:57 AM
Posted Sep 23, 2010, 9:15 PM
Increase the connection timeout of your connection string.connection timeout is a property to connection string...
Increase it to a higher value.normally it's in milli seconds.......
With Regards
P.Krishna Prasad