When i connect my vb.net with sql database i got this msg

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carlosk
    New Member
    • Sep 2014
    • 2

    When i connect my vb.net with sql database i got this msg

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim connection As New SqlClient.SqlConnection
            Dim command As New SqlClient.SqlCommand
            Dim adaptor As New SqlClient.SqlDataAdapter
            Dim dataset As New DataSet
            connection.ConnectionString = ("Data Source=.\SQLEXPRESS;CYRUS-PC\SQLEXPRESS\Databases\sample\Tables\dbo.Login=|DataDirectory|\DataBase.mdf;Integrated Security=True;User Instance=True")
            command.CommandText = "SELECT * FROM Login WHERE UserName='" & TextBox1.Text & "' AND Passwords='" & TextBox2.Text & "';"
            connection.Open()
            command.Connection = connection
            adaptor.selectCommand = command
            adaptor.Fill(dataset, "0")
            Dim count = dataset.Tables(0).Rows.Count
            If count > 0 Then
                MsgBox("Login Successfull", MsgBoxStyle.Information, "Login Passed")
            Else
                MsgBox("Invalid Account", MsgBoxStyle.Critical, "Login Failed")
                txtUsernameBox1.Clear()
                txtpassword.Clear()
            End If
        End Sub
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    What message do you get?

    Comment

    Working...