I am using Sqlite as a back End and Windows Form Application (C#) as a front end.
I am going through this code:
cmdgetTransaction_ID = new SQLiteCommand("SELECT MAX(transaction_id) as expr1 FROM transaction_master WHERE transaction_id LIKE '"+temp+"%' ", con);
SQLiteDataReader reader = cmdgetTransaction_ID.ExecuteReader();
if (reader["expr1"]!=DBNull.Value)
{
name= reader.GetString(0);
string[] substrings = System.Text.RegularExpressions.Regex.Split(name, "([a-z]+)|([0-9]+)");
MessageBox.Show(substrings[0]);
}
else
{
name=name+temp+"1";
lblTranID.Text = name;
}
I have also tried with this: if (reader.IsDBNull(0))
While debugging (step into) it reports following Exception :
A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.SQLite.dll
I can not figure it out what mistake i am doing, so that it generates an exception.