R
ramsey
I've got my DataSet built (and broken the connection), I've updated it
(changes only), and now I'm ready to send back the changes. Here's what I
tried:
private void UpdateDatabase()
{
OleDbCommand _update = new OleDbCommand(
"UPDATE tblDocuments SET InspDate=?, ChildDOB=?, ChildBlSampDate=? WHERE
DocumentID=?");
_update.Parameters.Add("InspDate", OleDbType.DBDate).SourceVersion =
DataRowVersion.Current;
_update.Parameters.Add("ChildDOB", OleDbType.DBDate).SourceVersion =
DataRowVersion.Current;
_update.Parameters.Add("ChildBlSampDate", OleDbType.DBDate);
_update.Parameters.Add("DocumentID", OleDbType.Char, 8);
_db.Open();
_update.Connection = _db;
_da.UpdateCommand = _update;
_da.Update(_dsBox, _dsBox.Tables[0].TableName );
_db.Close();
_dsBox.AcceptChanges();
}
Here's the error I get:
System.InvalidOperationException was unhandled
Message="Parameter[0] '' has no default value.\r\nParameter[1] '' has no
default value.\r\nParameter[2] '' has no default value.\r\nParameter[3] ''
has no default value.\r\n"
Source="System.Data"
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
Question: Why do I want a default value when the original data has values?
(changes only), and now I'm ready to send back the changes. Here's what I
tried:
private void UpdateDatabase()
{
OleDbCommand _update = new OleDbCommand(
"UPDATE tblDocuments SET InspDate=?, ChildDOB=?, ChildBlSampDate=? WHERE
DocumentID=?");
_update.Parameters.Add("InspDate", OleDbType.DBDate).SourceVersion =
DataRowVersion.Current;
_update.Parameters.Add("ChildDOB", OleDbType.DBDate).SourceVersion =
DataRowVersion.Current;
_update.Parameters.Add("ChildBlSampDate", OleDbType.DBDate);
_update.Parameters.Add("DocumentID", OleDbType.Char, 8);
_db.Open();
_update.Connection = _db;
_da.UpdateCommand = _update;
_da.Update(_dsBox, _dsBox.Tables[0].TableName );
_db.Close();
_dsBox.AcceptChanges();
}
Here's the error I get:
System.InvalidOperationException was unhandled
Message="Parameter[0] '' has no default value.\r\nParameter[1] '' has no
default value.\r\nParameter[2] '' has no default value.\r\nParameter[3] ''
has no default value.\r\n"
Source="System.Data"
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
Question: Why do I want a default value when the original data has values?