Agito Kelvin
Agito Kelvin

Reputation: 17

VB.net How to Update 2 column in a single sql code

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 & ";"

Upvotes: 0

Views: 158

Answers (1)

Nadeem_MK
Nadeem_MK

Reputation: 7689

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

Upvotes: 2

Related Questions