Hello people i have a problem with my reasent code , the thing is
i am trying to create a registering form that automaticly creates the username and password inside of the database that a made with vb 2010
this is the code that im trying to figure out i hope any1 can help me with a solution.
i am trying to create a registering form that automaticly creates the username and password inside of the database that a made with vb 2010
this is the code that im trying to figure out i hope any1 can help me with a solution.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connection As New SqlClient.SqlConnection
Dim command As New SqlClient.SqlCommand
Dim adaptor As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
connection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True"
command.CommandText = "INSERT * INTO [Users] WHERE (Username ,Password)VALUES('" + TextBox1.Text + "') AND ('" + TextBox2.Text + "');"
connection.Open()
command.Connection = connection
adaptor.SelectCommand = command
adaptor.InsertCommand = command
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
Me.Hide()
Form3.Show()
Else
MsgBox("Incorrect Password")
TextBox1.Clear()
TextBox2.Clear()
End If