cool kid

cool kid

  • NA
  • 11
  • 3.8k

unable to update multiple colums

Aug 2 2012 2:13 PM
hi there,
Im doing a reservation seats. In my database i have a columns t1,t2,t3 and etc where i want to assign it to 'booked'. But i keep getting error near "=". I tried and it seems the error is from the array part

Dim s As String = lblSelected.Text.ToString()
Dim forbook() As String
forbook = Split(s, ",")
For i As Integer = 0 To UBound(forbook)
mycn2.Open()
sql2 = "UPDATE bookingDetails SET '" & forbook(i).ToString() & "'='booked' WHERE bookingDate=@bookingDate AND startTime=@startTime AND endTime=@endTime AND storeId=@storeId"
cmd2.Parameters.AddWithValue("@bookingDate",DateTime.Parse(bookingDAte.ToString(formatDate)))
cmd2.Parameters.AddWithValue("@startTime", startTime)
cmd2.Parameters.AddWithValue("@endTime", endTime)
cmd2.Parameters.AddWithValue("@storeId", storeId)
cmd2.ExecuteNonQuery()
Next
mycn.close()


Any help would be much appreciated. Thanks in advance.

Answers (9)