Hi!
I use the following code to access a mdb file with a asp.net project:
Code:
OleDbConnection con = new OleDbConnection(strDbConnString);
con.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = con;
cmd.CommandText = "SELECT COUNT(*) FROM login WHERE Email=@ParamEmail";
cmd.Parameters.Add("@ParamEmail", TbxEmail.Text);
object oResult = cmd.ExecuteScalar();
string lldt = DateTime.Now.ToString();
cmd.CommandText = "UPDATE login SET LastLogin=@ParamDate WHERE Email=@ParamEmail";
cmd.Parameters.Add("@ParamDate", lldt);
cmd.Parameters.Add("@ParamEmail", TbxEmail.Text);
cmd.ExecuteNonQuery();
con.Close();
cmd.Dispose();
con.Dispose();
The problem is that the second cmd.ExecuteNonQuery() does fail! I mean it doesn't fail with any error message or anything. It just doesn't do anything, no matter what I try!
Both .Execute work fine when they are used ALONE! But if I use them in a row the second one doesn't do anything.
Since this is a Web-App I thought in terms of speed I can reuse the connection. Do I have to establish a new one everytime I use a .Execute command?
Or is there another problem with this code?
Thanks for help!
atzplzw