我无法更新我的数据库。我有一个名为 Table2 的表,其中包含 3 列:时间、罢工和 vol。请检查行语句中的注释。在此先感谢您的帮助。
VolLoc = Math.Sqrt(Math.Abs(VarianceLoc));
Console.WriteLine("Local Volatility at strike " + strike1_run + " and time " + time0_run + " is: " + VolLoc + "\n"); // works perfectly at this point, I have a new value for my variable VolLoc
string StrCmd1 = "UPDATE Table2 SET (vol = @vol_value) WHERE ((time = @T0_value) AND (strike = @K1_value))"; // HERE is the problem, when I debug, the cursor steps on it normally but the database is not updated !!
OleDbCommand Cmd1 = new OleDbCommand(StrCmd1, MyConn);
Cmd1.Parameters.Add("@vol_value", OleDbType.VarChar);
Cmd1.Parameters["@vol_value"].Value = VolLoc.ToString();
Cmd1.Parameters.Add("@T0_value", OleDbType.VarChar);
Cmd1.Parameters["@T0_value"].Value = time0_run.ToString();
Cmd1.Parameters.Add("@K1_value", OleDbType.VarChar);
Cmd1.Parameters["@K1_value"].Value = strike1_run.ToString(); //the cursor steps on each of the line statements above, but the database is still not updated