Click here to Skip to main content
15,891,766 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello i would like to ask.
can anyone correct this code for me??
VB
cm.CommandText = "SELECT * FROM Table1 WHERE uname='" & TextBox1.Text & "' AND pword='" & TextBox2.Text & "';"
        cm.Connection = cn
        adap.SelectCommand = cm
        Dim ds As New DataSet
        adap.Fill(ds, "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")
            TextBox1.Clear()
            TextBox2.Clear()
        End If


i found that
Dim count = DataSet.Tables(0).Rows.Count
got error on 'tables(0)'
cause i m not using sql.. :(
help me pls..
thx
Posted

1 solution

arnoldxx, looks like just a minor adjustment will get your code to work. DataSet is a Type and therefore not the actual target you are filling with the adapter.

VB
Dim count = DataSet.Tables(0).Rows.Count


Should be...

VB
Dim count = ds.Tables(0).Rows.Count
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900