Hi friends , i m developing a mobile application using C#, sqlite3.6 database. i have created CAB file and installed in my Windows Handheld device. I m able to get data from my table which i have inserted using sqlite3 command line utility. but when i logs in using mobile applicatoin and want to do insertion of data i get an error message: Database File is Locked.. but when i want to display data using same form , i get the data in gird view.. What is the problem with insertion operation. My code is bellow:
my database name is :Stockdb.db
i have two tables: User_Login(User_Name,Password), Entry_Master(Container_No,Container_name,...... 11 columns).
When i m using only one table from Stockdb.db i m able to perform all insert operation, display operation, but when i use first User_Login table to verify users,it get verified and my main form is loaded. here i have a command button which loads Entry_Form. this form i enter all the data which is required, when i click on save button i get Database File Locked Error: while when i directly load my main form and and loads my Entry_form i m able to insert data in Entry_table.
Can't we use two tables one by one from a single database:
My saving code is as bellow:
private void btnok_Click(object sender, EventArgs e)
{
// SQLiteTransaction tran1 = null;
try
{
using (SQLiteConnection con = new SQLiteConnection("Data Source=|DataDirectory|Stockdb.db"))
{
con.Open();
SQLiteCommand cmd2 = new SQLiteCommand();
cmd2.Connection = con;
// cmd2.Transaction = tran1;
MessageBox.Show("I m in insert process");
cmd2.CommandText = "insert into Entry_Table(Container_No,Super_Cd)values('"+txtcontainerno.Text.Trim()+"','"+txtSuperCode.Text.Trim()+"')";
cmd2.ExecuteNonQuery();
MessageBox.Show("equeted");
cmd2.Dispose();
MessageBox.Show("Record Inserted");
// tran1.Commit();
con.Close();
}
}
catch (SQLiteException exp)
{
MessageBox.Show(exp.ToString());
}
}
Can any buddy suggest me what is the problem with my code: