I am trying to create a login window with MDI. It is connected to a SQL Server table test. I have changed the datatypes and deleted and recreated the DB. I have 2 columns: usr and pwd of datatype nvarchar.
Dim connetionString As String Dim cnn As SqlConnection connetionString = "Data Source=.;Initial Catalog=test;User ID=sa;Password=sasql" cnn = New SqlConnection(connetionString) Dim cmd As SqlCommand Dim myreader As SqlDataReader Dim query As String query = "Select usr From users WHERE (usr =" + TextBox1.Text + " and pwd = " + TextBox2.Text + ")" cmd = New SqlCommand(query, cnn) cnn.Open() myreader = cmd.ExecuteReader() If myreader.Read() Then Else MessageBox.Show("Incorrect username/password !", "LOGIN ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If cnn.Close() Thank you so much.