jeudi 15 septembre 2016

Converting SQLDataReader to String in VB.Net and if no work, why?

    Dim strConn As String
    strConn = "Data Source=xxxx;Initial Catalog=xxxx;Integrated Security=True"
    Dim conn As SqlClient.SqlConnection
    conn = New SqlClient.SqlConnection(strConn)
    Dim com As SqlClient.SqlCommand
    Dim reader As SqlClient.SqlDataReader
    conn.Open()
    com = New SqlClient.SqlCommand("select * from [user] where userName='name' and userPassword='123'", conn)
    reader = komanda.ExecuteReader
    Dim str As String
    Do While reader.Read()
        str = citac.GetString(1)
        If str = "name" Then
            MsgBox("Good day !")
        End If
    Loop
    reader.Close()
    conn.Close()
End Sub

Aucun commentaire:

Enregistrer un commentaire