Home > Net >  OleDbDataAdapter. Update error OleDbException: 'Parameter? _1 has no default value. '
OleDbDataAdapter. Update error OleDbException: 'Parameter? _1 has no default value. '

Time:09-17

Someone help me with what went wrong? Thank you very much! The code is as follows:

 
OleDbConnection conn=new OleDbConnection (" Provider=Microsoft. JET. The OLEDB. 4.0; Data Source="+ @" C: \ Temp \ 901. MDB ");
Conn. The Open ();

OleDbDataAdapter adapter=new OleDbDataAdapter (" SELECT * FROM OrderTransactions ORDER BY OrderTransactionID ", conn);

OleDbCommand updateCommand=new OleDbCommand (" UPDATE OrderTransactions SET LastRowHash=? WHERE OrderTransactionID=? ", conn);

UpdateCommand. The Parameters. The Add (" p1 ", OleDbType VarWChar, 50, "LashRowHash");
OleDbParameter param=updateCommand. The Parameters. The Add (" p2 ", OleDbType. Integer);
Param. SourceColumn="OrderTransactionID";
Param. SourceVersion=DataRowVersion. The Original;

Adapter. UpdateCommand=UpdateCommand;
The DataTable data=https://bbs.csdn.net/topics/new the DataTable ();
Adapter. The Fill (data);

String rowString;
Foreach (DataRow row in the data. The Rows)
{
RowString="";
Foreach (DataColumn col in the data. The Columns)
{
If (col) ColumnName) ToUpper ()!="LASTROWHASH")
{
RowString +=row [col]. ToString ();
}
}

String hashString=ComputeMD5 (rowString);
If (row [" LastRowHash "]. ToString ()!=hashString)
{
Row [" LastRowHash "]=hashString;
}
}

Adapter. Update (data);

Conn. Close ();

  •  Tags:  
  • C#
  • Related