1 Replies - 815 Views - Last Post: 23 January 2010 - 05:13 AM Rate Topic: -----

#1 kanuri1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 04-January 10

update command

Post icon  Posted 23 January 2010 - 04:12 AM

hi iam written the update commands very strengthly........
please short them.....as in a single update command.
here my commands are.......

  conn.Open()
		Dim insert1 As New SqlClient.SqlCommand("update guesthouse set check= 'C' where (date_of_arr >= getdate() and date_of_dept >= getdate()) ", conn)
		Dim insert2 As New SqlClient.SqlCommand("update guesthouse set check= 'O' where (date_of_arr <= getdate() and date_of_dept >= getdate()) ", conn)
		Dim insert3 As New SqlClient.SqlCommand("update guesthouse set check= 'S' where (date_of_arr <= getdate() and date_of_dept <= getdate()) ", conn)
		insert1.ExecuteNonQuery()
		insert2.ExecuteNonQuery()
		insert3.ExecuteNonQuery()
		conn.Close()



Is This A Good Question/Topic? 0
  • +

Replies To: update command

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: update command

Posted 23 January 2010 - 05:13 AM

Check out this SQL tutorial about Update command:
http://www.w3schools.../sql_update.asp

Example taken from the page:
UPDATE Persons
SET Address='Nissestien 67', City='Sandnes'
WHERE LastName='Tjessem' AND FirstName='Jakob'



See how those different columns which want to be updated are separated with comma.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1