我有以下代码将在同一行中设置 2 个值,它真的很简单,但我不知道如何将它组合到一个查询中
Dim cnn As New SqlConnection
Dim sqlcmd As New SqlCommand("SELECT catalogid, delivered,nodilivary FROM supporder", cnn)
sqlcmd.CommandText = "update supporder SET delivered=@delivered WHERE catalogid=@catalogid"
sqlcmd.Parameters.Add(New SqlParameter("@delivered", GridControl2.GetCellValue(currentrowindex, "delivered")))
sqlcmd.Parameters.Add(New SqlParameter("@catalogid", GridControl2.GetCellValue(currentrowindex, "catalogid")))
cnn.Open()
sqlcmd.ExecuteNonQuery()
sqlcmd.Parameters.Clear()
cnn.Close()
sqlcmd.CommandText = "update supporder SET nodilivary=@nodilivary WHERE catalogid=@catalogid"
sqlcmd.Parameters.Add(New SqlParameter("@nodilivary", GridControl2.GetCellValue(currentrowindex, "nodilivary")))
sqlcmd.Parameters.Add(New SqlParameter("@catalogid", GridControl2.GetCellValue(currentrowindex, "catalogid")))
cnn.Open()
sqlcmd.ExecuteNonQuery()
sqlcmd.Parameters.Clear()
cnn.Close()