SQlite DB doesn't show data in DB Browser for SQlite, but when I query the db from my application the rows exist
So I have a Sqlite DB that appears to be working fine. All data can be pulled from the DB just fine and even saves work to a degree it tells me that rows were effected, but when I go to look in the DB browser for Sqlite no rows are populated for the values that i didn't populate through the DB browser. I've written helper methods inside my application that query the db and bring back data for those tables that appear empty. Below is my method for saving a session object to my db Session is just a POCO with an id username login,logout
public bool saveSession(Session session)
{
using (SQLiteConnection cnn = new SQLiteConnection(ConfigurationManager.ConnectionStrings["Default"].ConnectionString))
{
cnn.Open();
using (SQLiteTransaction tr = cnn.BeginTransaction())
{
using (SQLiteCommand cmd = cnn.CreateCommand())
{
cmd.Transaction = tr;
cmd.CommandText = "insert into Session (username,login) values('" + session.username + "','" + session.login.ToString() + "');";
int rowsEffected = cmd.ExecuteNonQuery();
tr.Commit();
cnn.Close();
if (rowsEffected <= 0)
return false;
else
return true;
}
}
}
}
Comments
Post a Comment