Can anyone help me with that? I am trying to connet but it didnt work.
Imports System.Data.SqlClient
Public Class Form2
Public Property newForm As Object
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (MsgBox("Vill Du fortsätta?", vbQuestion + vbYesNo, AppTitle) = MsgBoxResult.Yes) Then
End If
If TextBox1Username.Text = "" Or String.IsNullOrEmpty(TextBox1Username.Text) Or
TextBox2Password.Text = "" Or String.IsNullOrEmpty(TextBox2Password.Text) Then
Return
End If
Dim form As New FormNewAccount()
Dim connection As New SqlConnection("server = C:\Users\Hassan Al-Shommary\Documents\Login.md; Trusted_Connection = True ")
Dim command As New SqlCommand("Select * from Login where" = (Username =' + TextBox1Username.Text), connection)
Dim command As New SqlCommand("Select * from Login where" = (Password =' + TextBox2Password.Text), connection)
command.Parameters.Add("@Username", SqlDbType.VarChar).Value = TextBox1Username.Text
command.Parameters.Add("@password", SqlDbType.VarChar).Value = TextBox2Password.Text
Dim adapter As New SqlDataAdapter(command)
Dim table As New DataTable()
If table.Rows.Count() <= 0 Then
MsgBox("Username or Password are Inavlid")
Else
MsgBox("Login Successfully")
End If
form.Show()
Me.Hide()
End Sub