J
JoWilliam
Hi, I'm new to all this OleDb stuff. I'm using VB in Visual Studio .Net
2003.
The Data Adapter wizard for the OleDbDataAdapter control generates the
following OleDbUpdateCommand object for the query "SELECT Reference, Status,
DateCreated FROM Questions":
Me.OleDbUpdateCommand1.CommandText = "UPDATE Questions SET Reference
= ?, Status = ?, DateCreated = ? WHERE (Reference " & _
"= ?) AND (DateCreated = ? OR ? IS NULL AND DateCreated IS NULL) AND
(Status = ? " & _
"OR ? IS NULL AND Status IS NULL)"
Me.OleDbUpdateCommand1.Connection = Me.dbConn
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Reference",
System.Data.OleDb.OleDbType.VarWChar, 13, "Reference"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Status",
System.Data.OleDb.OleDbType.VarWChar, 20, "Status"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("DateCreated",
System.Data.OleDb.OleDbType.DBDate, 0, "DateCreated"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Reference",
System.Data.OleDb.OleDbType.VarWChar, 13,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Reference", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DateCreated",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DateCreated",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DateCreated1",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DateCreated",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Status",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Status", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Status1",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Status", System.Data.DataRowVersion.Original, Nothing))
What are the 2 parameters with prefix 'Original_' and suffix '1' used for?
What are the other 3 parameters prefixed by 'Original_' used for? Are they
used to hold the previous value of the column in case the update needs to be
rolled back?
The table has one primary key column, Reference. Therefore I can change the
update command to:
UPDATE Questions SET Status = ?, DateCreated = ? WHERE (Reference = ?)
If I do this, can I delete the Original_DateCreated1 and Original_Status1
parameters in the above code?
thanks,
2003.
The Data Adapter wizard for the OleDbDataAdapter control generates the
following OleDbUpdateCommand object for the query "SELECT Reference, Status,
DateCreated FROM Questions":
Me.OleDbUpdateCommand1.CommandText = "UPDATE Questions SET Reference
= ?, Status = ?, DateCreated = ? WHERE (Reference " & _
"= ?) AND (DateCreated = ? OR ? IS NULL AND DateCreated IS NULL) AND
(Status = ? " & _
"OR ? IS NULL AND Status IS NULL)"
Me.OleDbUpdateCommand1.Connection = Me.dbConn
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Reference",
System.Data.OleDb.OleDbType.VarWChar, 13, "Reference"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Status",
System.Data.OleDb.OleDbType.VarWChar, 20, "Status"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("DateCreated",
System.Data.OleDb.OleDbType.DBDate, 0, "DateCreated"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Reference",
System.Data.OleDb.OleDbType.VarWChar, 13,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Reference", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DateCreated",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DateCreated",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DateCreated1",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DateCreated",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Status",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Status", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Status1",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Status", System.Data.DataRowVersion.Original, Nothing))
What are the 2 parameters with prefix 'Original_' and suffix '1' used for?
What are the other 3 parameters prefixed by 'Original_' used for? Are they
used to hold the previous value of the column in case the update needs to be
rolled back?
The table has one primary key column, Reference. Therefore I can change the
update command to:
UPDATE Questions SET Status = ?, DateCreated = ? WHERE (Reference = ?)
If I do this, can I delete the Original_DateCreated1 and Original_Status1
parameters in the above code?
thanks,