Query '' is corrupt

  • Thread starter Thread starter Jeff0803
  • Start date Start date
J

Jeff0803

Guest
An error("Query '' is corrupt") occur from following code.


using (OleDbConnection conn_CDMR = new OleDbConnection(ConnectionString_CDMR))
{
queryString = "UPDATE user_option " +
"SET ansnumber = " + settingvalues.RepeatPerDay.ToString() +
" WHERE option_name = 'RepeatPerDay'";
conn_CDMR.Open();
command = new OleDbCommand(queryString, conn_CDMR);
command.ExecuteNonQuery(); <==== Error occur
conn_CDMR.Close();

}


Error occur at command.ExecuteNonQuery();

If I display queryString, it is like following. have no problem.

"UDATE user_option SET ansnumber = 1 WHERE option_name = 'RepeatPerDay'"
The error is like following.
System.Data.OleDb.OleDbException (0x80004005): Query '' is corrupt.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at Denttio.Message.CDMrCommon.SaveSettingValues() in C:\WorkDir\DenttioMessageApplication\CDMrCore\CDMrCommon.cs:line 4748
at Denttio.Message.SettingsForm.bttnSave_Click(Object sender, EventArgs e) in C:\WorkDir\DenttioMessageApplication\CDMMsgView\SettingsForm.cs:line 111
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)

Can anybody give me some advice?

Continue reading...
 
Back
Top