hi,
i got an problem i wants to update the serialnumber in the database,
if i was updating the serial number as (for eg: 3 in place of 4), it was updated.
if i was updating the serial number as 3 in place of 4..
here serial number 3 is already in the database of same field and actually it was not updated.but here it was updated.

pls give me the code.
here iam using asp.net with vb.net
database is sqlserver-2005.
here my code is given below,,,

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click

        Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("guest1").ConnectionString())
        Dim adp As SqlDataAdapter
        Dim ds As New DataSet
        Dim SQL As String = "update guesthouse set room_no ='" & TextBox4.Text & "' where room_no='" & TextBox3.Text & "' and booking_no ='" & sino.Text & "'"
        conn.Open()
        Dim com As New SqlCommand(SQL, conn)
        com.ExecuteNonQuery()
        Label2.Text = " Room Is Changed"
        conn.Close()
        conn.Dispose()
    End Sub
sknake commented: duplicate posts -1

Recommended Answers

All 2 Replies

I didn't understand your problem. My observation is your code looks ok.

I didn't understand your problem. My observation is your code looks ok.

here probem is for exaple the data base field as like
room_no
1
2
3
4
5
if i wants to update in place of 3 as 6 it is possible
if i wants to update in place of 3 as 5(because 5 is already exits in the same field) ,originally it was not updated here,,but it was updated here...

so please give me the code

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.