我试图做一个SQL参数化更新命令为DBF文件(视觉福克斯临)我不知道为什么,但我对一个“语法错误”“DbCommand.ExecuteNonQuery();”。
异常错误消息是“语法错误。” 我没有任何其它附加信息。
string maRequete = "UPDATE " + strNomTable + " set "
+ "evetype = @evetype ,"
+ "evedes = @evedes ,"
+ "evecli = @evecli ,"
+ "eveusermo = @eveusermo ,"
+ "eveinterv = @eveinterv where eveNum = '" + strEvtNumeroString.ToString() + "'";
OleDbCommand DbCommand = new OleDbCommand(maRequete);
DbCommand.Parameters.Add("@evetype", OleDbType.VarChar);
DbCommand.Parameters.Add("@evedes", OleDbType.VarChar);
DbCommand.Parameters.Add("@evecli", OleDbType.VarChar);
DbCommand.Parameters.Add("@eveusermo", OleDbType.VarChar);
DbCommand.Parameters.Add("@eveinterv", OleDbType.VarChar);
DbCommand.Parameters["@evetype"].Value = m_strEvtType.ToString().Trim();
DbCommand.Parameters["@evedes"].Value = m_strDesignation.ToString().Trim();
DbCommand.Parameters["@evecli"].Value = m_strCodeClient.ToString().Trim();
DbCommand.Parameters["@eveusermo"].Value = m_strUserModification;
DbCommand.Parameters["@eveinterv"].Value = m_strCodeIntervenant.ToString().Trim();
try
{
string strStringConnect = @"Provider=vfpoledb.1;Data Source=" + m_strDirectoryDBF + @"\" + strDbfFile + ".dbf;Collating Sequence=general";
OleDbConnection DbConnection = new OleDbConnection(strStringConnect);
DbCommand.CommandType = System.Data.CommandType.Text;
DbConnection.Open();
DbCommand.Connection = DbConnection;
DbCommand.ExecuteNonQuery();
return "O";
}
catch (Exception Ex)
{
return Ex.Message;
}
我试图用一个参数“在哪里”的声明,并没有改变:(
任何人有想法吗?
非常感谢 :)