Error in executing an OleDbCommand.. “Must declare the scalar variable ”@MaxID“.”

后端 未结 4 1217
醉梦人生
醉梦人生 2021-01-14 07:48
private void AddValue(string strValue)

{

      //get the maximum id for Lists first

      int MaxID = DataOperations.ReturnMaxIDInATable(\"Lists\", connString);
          


        
4条回答
  •  醉话见心
    2021-01-14 08:08

    The following fragment should read:

    IDParam.ParameterName = "MaxID";
    IDParam.OleDbType = OleDbType.BigInt;
    IDParam.Value = MaxID;
    dbComm.Parameters.Add(IDParam);
    
    dbComm.Parameters.AddWithValue("ListName", ListName);
    dbComm.Parameters.AddWithValue("ListValue", strValue);
    

提交回复
热议问题