0
此UPDATE查询不会更新任何值,也不会产生任何错误......该查询中的问题是什么?此更新查询中的问题是什么?
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Using conn = New SqlConnection(constr)
Using cmd = conn.CreateCommand()
conn.Open()
Dim sql As String = "UPDATE hotels SET city [email protected], hotel [email protected], location [email protected], price [email protected], category [email protected], short [email protected], details [email protected] WHERE hotelid [email protected]"
cmd.CommandText = sql
cmd.Parameters.AddWithValue("@city", TextBox1.Text)
cmd.Parameters.AddWithValue("@hotel", TextBox2.Text)
cmd.Parameters.AddWithValue("@location", TextBox3.Text)
cmd.Parameters.AddWithValue("@price", TextBox4.Text)
cmd.Parameters.AddWithValue("@category", Rating1.CurrentRating)
cmd.Parameters.AddWithValue("@short", TextBox6.Text)
cmd.Parameters.AddWithValue("@details", Editor1.Content)
cmd.Parameters.AddWithValue("@hotelid", Request.QueryString("hotelid"))
cmd.ExecuteNonQuery()
End Using
End Using
Catch ex As Exception
Response.Write(ex.Message)
End Try
提取的查询:
UPDATE hotels
SET city = @city, hotel = @hotel,
location = @location, price = @price,
category = @category, short = @short, details = @details
WHERE hotelid = @hotelid
'hotelid'设置为什么? – 2011-02-16 10:23:26