As per your question and the thread going on here.. My assumption is that,
you have a registration page which is saving values in to the database.
Also You have one more page (Login Page) which is used to find - credentails passed by user is valid or not by checking from database.
Now you want to achieve this functionality by using windows forms.
If my understanding is correct .. Please find the below code:
Public Function validateName(txtuserName As String,txtpassword as string) As Integer
Using conn As New SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Staff;Integrated Security=True")
Using dbCommand As New SqlCommand("SELECT COUNT(*) FROM StaffDirectory WHERE StaffName=@Name and password=@pwd")
dbCommand.Connection = conn
Dim matchesCount = dbCommand.ExecuteScalar
If matchesCount IsNot Nothing AndAlso matchesCount IsNot DBNull.Value Then
If the above code is perfectly working..
then you have to insert the below code to redirect to your homepage in the necessary place.
HomeForm objHomeForm = new HomeForm();
objHomeForm.Show();Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator