Hi,
I wrote a program which includes writing and reading from database. When I run the app and try to perform writing I call the following method:
public static void AddMessage(string callID, string content)
{
string select =
"INSERT INTO Sporocilo (oznaka_klica, smer, vsebina, prebrano, cas_zapisa) VALUES (@callId, 0, @content, 0, @insertTime)";
SqlCommand cmd = new SqlCommand(select, conn);
cmd.Parameters.AddWithValue("callId", callID.ToString());
cmd.Parameters.AddWithValue("content", content);
cmd.Parameters.AddWithValue("insertTime", "10.10.2008");
try
{
conn.Open();
cmd.ExecuteScalar();
}
catch(Exception ex)
{
string sDummy = ex.ToString();
}
finally
{
conn.Close();
}
}
After the method call I read all the records from the table and display them in the form. The record inserted before refresh could be seen but then when I exit the app and look at the table I don't see the record.
Does anyone know what could cause such behavior?