I have in same SQL database with
. a table RoomList with 5 columns: RoomNum, Daily, Weekend, Holiday, Special
with 1 row has RoomNum values of 102
. a table AssignedList with 6 columns: RNum, RDaily, RWeekend, RHoliday, Special, GConf
with 1 row has ordered values are 102 $50.00 $60.00 $70.00 $100.00 '12345'
*) Except the GConf equal String, the other fields are same types
- I want to copy those 4 rates from table AssignedList where GConf = '12345' to table RoomList from same Room 102
==================================================================================
strSQL = "UPDATE RoomList SET "
strSQL = strSQL & "Daily = RDaily, Weekend = RWeekend, Holiday = RHoliday "
strSQL = strSQL & "FROM RoomList INNER JOIN AssignedList ON RoomNum = RNum "
strSQL = strSQL & "WHERE GConf = '12345'"
cmdMSA = New OleDbCommand(strSQL, dbConn2)
Try
If Not (cmdMSA.ExecuteScalar() = Nothing) Then
f_Failed = True
End If
Catch ex As Exception
MessageBox.Show("Error Update RoomList from AssignedList = " & ex.Message)
End Try
cmdMSA.Dispose()
==================================================================================
Show ---> Error Update RoomList from AssignedList = Syntax error (missing operator) in query
expression 'RHoliday FROM RoomList INNER JOIN AssignedList ON RoomNum = RNum'
Note: I follow this link Update one table with another tables values - MS SQL
*) Can someone help otherwise?
. a table RoomList with 5 columns: RoomNum, Daily, Weekend, Holiday, Special
with 1 row has RoomNum values of 102
. a table AssignedList with 6 columns: RNum, RDaily, RWeekend, RHoliday, Special, GConf
with 1 row has ordered values are 102 $50.00 $60.00 $70.00 $100.00 '12345'
*) Except the GConf equal String, the other fields are same types
- I want to copy those 4 rates from table AssignedList where GConf = '12345' to table RoomList from same Room 102
==================================================================================
strSQL = "UPDATE RoomList SET "
strSQL = strSQL & "Daily = RDaily, Weekend = RWeekend, Holiday = RHoliday "
strSQL = strSQL & "FROM RoomList INNER JOIN AssignedList ON RoomNum = RNum "
strSQL = strSQL & "WHERE GConf = '12345'"
cmdMSA = New OleDbCommand(strSQL, dbConn2)
Try
If Not (cmdMSA.ExecuteScalar() = Nothing) Then
f_Failed = True
End If
Catch ex As Exception
MessageBox.Show("Error Update RoomList from AssignedList = " & ex.Message)
End Try
cmdMSA.Dispose()
==================================================================================
Show ---> Error Update RoomList from AssignedList = Syntax error (missing operator) in query
expression 'RHoliday FROM RoomList INNER JOIN AssignedList ON RoomNum = RNum'
Note: I follow this link Update one table with another tables values - MS SQL
*) Can someone help otherwise?