本文整理匯總了VB.NET中System.Data.IDbDataAdapter.UpdateCommand屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET IDbDataAdapter.UpdateCommand屬性的具體用法?VB.NET IDbDataAdapter.UpdateCommand怎麽用?VB.NET IDbDataAdapter.UpdateCommand使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Data.IDbDataAdapter
的用法示例。
在下文中一共展示了IDbDataAdapter.UpdateCommand屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: CreateCustomerAdapter
Private Function CreateCustomerAdapter( _
ByVal connection As OleDbConnection) As OleDbDataAdapter
Dim dataAdapter As New OleDbDataAdapter()
Dim command As OleDbCommand
Dim parameter As OleDbParameter
' Create the SelectCommand.
command = New OleDbCommand("SELECT * FROM dbo.Customers " & _
"WHERE Country = ? AND City = ?", connection)
command.Parameters.Add("Country", OleDbType.VarChar, 15)
command.Parameters.Add("City", OleDbType.VarChar, 15)
dataAdapter.SelectCommand = command
' Create the UpdateCommand.
command = New OleDbCommand("UPDATE dbo.Customers " & _
"SET CustomerID = ?, CompanyName = ? " & _
"WHERE CustomerID = ?", connection)
command.Parameters.Add( _
"CustomerID", OleDbType.Char, 5, "CustomerID")
command.Parameters.Add( _
"CompanyName", OleDbType.VarChar, 40, "CompanyName")
parameter = command.Parameters.Add( _
"oldCustomerID", OleDbType.Char, 5, "CustomerID")
parameter.SourceVersion = DataRowVersion.Original
dataAdapter.UpdateCommand = command
Return dataAdapter
End Function