Hello, I'm getting this error:
... indicating the line:An unhandled exception of type 'System.' occurred in System.Data.SQLite.dll
cannot access a disposed object
VB.NET Code:
sqliteDataAdapter = new SQLiteDataAdapter("SELECT * FROM tbl_programs;", m_dbConnection);
Here's my code:
VB.NET Code:
private void addNew_tsmi_Click(object sender, EventArgs e) { info_lbl.Text = "yeni program ekleniyor"; List<string> list = new List<string>(); int result; using (InsertData insertData = new InsertData()) { insertData.ShowDialog(); list = insertData.GetValues(); } using (SQLiteConnection connection = m_dbConnection) { using (SQLiteCommand command = new SQLiteCommand( "INSERT INTO tbl_programs " + "(int_isSelected, txt_programName, int_is86, int_is64, txt_preCommand, " + "txt_preSwitch, txt_executable, txt_switches, int_timeout, txt_md5, txt_version, " + "txt_description, txt_category, dt_insertDate) " + "VALUES(" + ":isSelected, :programName, :is86, :is64, :preCommand, :preSwitch, :executable, " + ":switches, :timeout, :md5, :version, :description, :category, :insertDate);", connection)) { command.Parameters.AddWithValue("isSelected", 0); command.Parameters.AddWithValue("programName", list[0]); ... connection.Open(); command.ExecuteNonQuery(); } } InitialiseDataAccessObjects(); GetData(); info_lbl.Text = "hazır"; } private void InitialiseDataAccessObjects() { sqliteDataAdapter = new SQLiteDataAdapter("SELECT * FROM tbl_programs;", m_dbConnection); sqliteCommandBuilder = new SQLiteCommandBuilder(sqliteDataAdapter); sqliteDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; } private void GetData() { // Retrieve the data. sqliteDataAdapter.Fill(dataTable); // The table can be used here to display and edit the data. // That will most likely involve data-binding but that is not a data access issue. }
Can anyone help me?




Reply With Quote
