hi iam written the update commands very strengthly........
please short them.....
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()

Hi
Execute your query this way...

update guesthouse set check=
Case
WHEN (date_of_arr >= getdate() and date_of_dept >= getdate())
THEN 'C'
WHEN (date_of_arr <= getdate() and date_of_dept >= getdate())
THEN '0'
WHEN (date_of_arr <= getdate() and date_of_dept <= getdate())
THEN 'S'
ELSE 'X'
END
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.