Validate student id,username if already exist in database table . Using VB.Net 2012 and SQL database on windows10 system. Thanks for your help.this is my first post so thank you for your help guys.
Private Sub InsertSutdent()
SQL.AddParam("@stud_name", txtFirstname.Text)
SQL.AddParam("@stud_lastname", txtlastname.Text)
SQL.AddParam("@stud_id", txtStudentId.Text)
SQL.AddParam("@stud_username", txtUsername.Text)
SQL.AddParam("@stud_course", cbxCourse.Text)
SQL.AddParam("@stud_password", txtpassword.Text)
SQL.AddParam("@active", Status.Checked)
SQL.ExecQuery("INSERT INTO Student (Stud_Firstname,Stud_Lastname,Stud_idnum,Stud_Password,Stud_Course,JoinDate,Stud_Username,Active) " & _
"VALUES (@stud_name,@stud_lastname,@stud_id,@stud_password,@stud_course,GETDATE(),@stud_username,@active);", True)
If SQL.HasException(True) Then Exit Sub
If SQL.DBDT.Rows.Count > 0 Then
Dim r As DataRow = SQL.DBDT.Rows(0)
regrow.Text = (r("LastID").ToString)
End If
indicator.Text = "Added!"
LoadStudent()
End Sub