0

I want to update status and confirmstudentID to the room table at the same time, can I do in single sql code or should I split it out? How?

       sql = "update room set status = '" & status & "' and set confirmstudentid= " & Form1.stuID & "where id=" & lblroomID.Text & ";"
Heinzi
  • 167,459
  • 57
  • 363
  • 519
  • Please use [parameterized queries](http://stackoverflow.com/q/542510/87698). Your code is vulnerable to [SQL injection](http://xkcd.com/327/). – Heinzi Sep 23 '14 at 15:05

1 Answers1

2

Try the below;

sql = "update room set status = '" & status & "' , confirmstudentid = " & 
       Form1.stuID & " where id= " & lblroomID.Text & ";"

You only need to separate the columns by a comma , instead of adding another set

Nadeem_MK
  • 7,533
  • 7
  • 50
  • 61