sino po bang may sample jan bawt add, update, edit, and delete using msaccess?...for reference lang sana di ko pa rin kasi ako makalagay nang data using msaccess...anayway ano po bang mali dito
Private Sub BtnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRegister.Click
Dim breturn As Boolean
Dim strquery As String
Dim cn As ADODB.Connection
cn = New ADODB.Connection
cn.ConnectionString = kbstrConnectionString
On Error GoTo Err_LINE
cn.Open()
'strquery = "INSERT INTO UserInfo ("
'strquery = strquery & "UserCode, "
'strquery = strquery & "Name, "
'strquery = strquery & "Address, "
'strquery = strquery & "Mobile, "
'strquery = strquery & "Username, "
'strquery = strquery & "Pwd, "
'strquery = strquery & "Type, "
'strquery = strquery & "Tcode, "
'strquery = strquery & ")"
'strquery = strquery & "VALUES "
'strquery = strquery & "("
'strquery = strquery & "'" & txtUserCode.Text & "', "
'strquery = strquery & "'" & txtname.Text & "', "
'strquery = strquery & "'" & txtaddress.Text & "', "
'strquery = strquery & "'" & txtmobile.Text & "', "
'strquery = strquery & "'" & txtusername.Text & "', "
'strquery = strquery & "'" & txtpassword.Text & "', "
'strquery = strquery & "'" & txttype.Text & "', "
'strquery = strquery & ")"
strquery = "INSERT INTO UserInfo (UserCode, " & _
"Name, Address, Mobile, Username, Pwd, Type,) " & _
"Values ('" & txtUserCode.Text & "'," & _
" ' " & txtname.Text & "' , " & _
" ' " & txtaddress.Text & "' , " & _
" ' " & txtmobile.Text & "' , " & _
" ' " & txtusername.Text & "' , " & _
" ' " & txtpassword.Text & "', " & _
" ' " & txttype.Text & "')"
Dim cmd As ADODB.Command
cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandText = strquery
cmd.CommandType = ADODB.CommandTypeEnum.adCmdText
Dim n As Integer
cmd.Execute
If n = 1 Then
breturn = True
u_usercode = txtUserCode.Text
MsgBox("Registration Successful ", vbInformation)
Else
breturn = False
MsgBox("Registration was not Successful", vbInformation)
u_usercode = ""
End If
ERR_RESUME:
cn.Close()
cn = Nothing
Exit Sub
Err_LINE:
breturn = False
MsgBox(Err.Description)
Resume ERR_RESUME
End Sub
syntax error daw...maraming salamat..sorry sa pang novice na tanong ngayun pa lang kasi ako nakabalik sa vb.net ulit at first time ko rin sa msaccess....