Imports System.Data.OleDb
Public Class Form1
Public con As New OleDbConnection
Public cmd As New OleDbCommand
Public da As New OleDbDataAdapter
Public dr As OleDbDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oOLE As String
Try
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\BOND\BOND\bin\database\RBIBOND.mdb;Persist security info=False;"
con.Open()
oOLE = "Insert into UserMast(userid,username,password,rpassword) values (@userid,@username,@password,@rpassword)"
cmd = New OleDbCommand(oOLE, con)
cmd.Parameters.AddWithValue("@userid", TextBox1.Text)
cmd.Parameters.AddWithValue("@username", TextBox2.Text)
cmd.Parameters.AddWithValue("@password", TextBox3.Text)
cmd.Parameters.AddWithValue("@rpassword", TextBox4.Text)
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Data Saved Successfully")
End Try
con.Close()
End Sub
End Class
SANJAY26
0
Newbie Poster
Recommended Answers
Jump to Post"password" is a protected variable in SQL. Try this instead:
oOLE = "Insert into UserMast(userid,username,[password],rpassword) values (@userid,@username,@password,@rpassword)"
Jump to Postchange:
cmd.Parameters.AddWithValue("@userid", TextBox1.Text)
to:
cmd.Parameters.AddWithValue("@userid", CInt(TextBox1.Text))
All 6 Replies
GeekByChoiCe
152
Practically a Master Poster
Featured Poster
SANJAY26
0
Newbie Poster
GeekByChoiCe
152
Practically a Master Poster
Featured Poster
SANJAY26
0
Newbie Poster
SANJAY26
0
Newbie Poster
SANJAY26
0
Newbie Poster
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.