hi. now im currently developing an application as my semester project and i strucked becuse of an small error. i have tried to update a record set in the sql server 2005 databse table by giving the following code. but its not showing any errors its working and displaying a message succeeded. but in database table i cant find any changes. pls help me........
my advance thanks for those who viewing my thread.
sql Code:
Public Shared ReadOnly SQLConnectionString As String = "Server=RUSHAN\SQLEXPRESS;Database=nolimit;Trusted_Connection=True;" Dim cnn As SqlClient.SqlConnection Dim cmd As SqlClient.SqlCommand Dim bc As SqlClient.SqlDataAdapter Dim dr As SqlClient.SqlDataReader Private Sub cus_mod_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cus_mod_btn.Click Dim sql2 As String = "UPDATE customer SET name='" & cus_mod_nme.Text & "', address='" & cus_mod_add.Text & "' ,contact='" & cus_mod_con.Text & "' WHERE (id='" & cus_mod_id.SelectedIndex & "') " cnn = New SqlClient.SqlConnection(SQLConnectionString) 'cnn = New SqlClient.SqlConnection(SQLConnectionString) cnn.Open() cmd = New SqlClient.SqlCommand(sql2, cnn) cmd.ExecuteNonQuery() MsgBox("Records affected") cnn.Close() End Sub




Reply With Quote