I get this error . in vb.net .. what is the wrong in my code ?
Dim dataset As New DataSet
Dim adapter As New SqlClient.SqlDataAdapter
Dim command As New SqlClient.SqlCommand
Dim cmd = New SqlCommand
Dim con As New SqlConnection
Try
con.Open()
cmd.Connection = con
con.ConnectionString = "Data Source=lotus-pc\sqlexpress; Initial Catalog=LawyerSystem; Integrated Security= true "
cmd.CommandText = "SELECT * FROM [users] WHERE (username='" + TextBox1.Text + "')AND (password='" + TextBox2.Text + "' ) "
cmd.ExecuteNonQuery()
adapter.SelectCommand = command
adapter.Fill(dataset, "0")
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
HomePage.Show()
Else
MsgBox("uncorrect", MsgBoxStyle.Critical)
End If
Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
Finally
con.Close()
End Try