Hi. I have a problem. Im using SQL data adapter to connect to the database. It works fine, but when I want to uprate it, it returns an error. Can you please help me?
Here is the code:
Here is the code:
Code:
Select Case SaveAction
Case "Edit"
edit
Dim CurrentRow As DataRow
CurrentRow = Me.DsUsers1.HY_Users.Rows(Me.BindingContext(Me.DsUsers1.HY_Users).Position)
With CurrentRow
.BeginEdit()
.Item("Name") = Me.txtName.Text
.Item("Surname") = Me.txtSurname.Text
.Item("Email") = Me.txtEmail.Text
.Item("UsernameWeb") = Me.txtUsernameWeb.Text
.Item("Password") = Me.txtPassword.Text
.Item("PinCode") = CInt(Me.txtPINCode.Text)
.Item("UserLevel") = CInt(Me.txtUserlevel.Text)
.EndEdit()
End With
Case "Insert"
insert
Dim NewRow As DataRow
NewRow = Me.DsUsers1.HY_Users.NewRow
With NewRow
.Item("Name") = Me.txtName.Text
.Item("Surname") = Me.txtSurname.Text
.Item("Email") = Me.txtEmail.Text
.Item("UsernameWeb") = Me.txtUsernameWeb.Text
.Item("Password") = Me.txtPassword.Text
.Item("PinCode") = Me.txtPINCode.Text
.Item("UserLevel") = Me.txtUserlevel.Text
End With
Me.DsUsers1.HY_Users.Rows.Add(NewRow)
Case ""
Case Else
PopupBox("DEVELOPER MESSAGE, SaveAction does not exist")
End Select
SaveAction = ""
Me.SqlDataAdapter1.Update(Me.DsUsers1, "HY_Users") UNDONE: There it returns this error:
An unhandled exception of type System.Data.SqlClient.SqlException occurred in system.data.dll
Additional information: System error.