【发布时间】:2014-06-10 02:40:35
【问题描述】:
到目前为止,我的代码只更新了 1 行,但有没有办法指定三行? (3 个不同的 ID)
Public Shared Sub UpdatePrice(ByVal NewPrice As Decimal, ByVal id As Integer)
Dim dtoffenseinfo As New DataTable
If Not DBConnection.State = ConnectionState.Open Then
'open connection
DBConnection.Open()
Else
End If
cmd.Connection = DBConnection
cmd.CommandText = "UPDATE tblStockPrice " & _
" SET Price=" & NewPrice & " WHERE id=" & id & ""
cmd.ExecuteNonQuery()
DBConnection.Close()
End Sub
我假设我还需要另外两行的 2 个参数,这样就可以了。
【问题讨论】:
-
您想为所有三行设置相同的价格吗?
-
在search condition 或where clause 中使用
and我假设您使用的是 Ms Sql 服务器,因为您没有指定后端。 -
哦,不对,价格不一样。 @S。安
-
你使用的是什么 sql 后端?
-
@zespri 哎呀。只需 MS Access。