Private Sub btSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSubmit.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=.\CYRUS-PC\CYRUSSQL\Databases\USERS\Tables\dbo.Registration=|DataDirectory|\DataBase.mdf;Integrated Security=True;User Instance=True") command.CommandText = "INSERT INTO Registration Fname='" & txtFisrtName.Text & "' Lname='" & txtLastName.Text & "' Username='" & txtusername.Text & "'Gender='" & txtGender.Text & "' Password='" & txtPassword.Text & "';" connection.Open() command.Connection = connection adaptor.SelectCommand = command adaptor.Fill(dataset, "0") Dim count = dataset.Tables(0).Rows.Count If count > 0 Then MsgBox("registration succed", MsgBoxStyle.Information, "welcome to our system") Else MsgBox("registration failed", MsgBoxStyle.Exclamation, "try again") txtFisrtName.Clear() txtLastName.Clear() txtusername.Clear() txtGender.Clear() txtPassword.Clear() End If End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)