Hello,
I am trying to do something similar against a SQL server database with a user database already up and running.
The code below connects to the SQL server with no problems and returns the number of users that match the criteria.
My problem arises when I want to do a simple comprison against the result. How do I access the "NUM_OF_USERS" value for comparison?
I have this same issue with another part of the project where I can pull data from the DB but I can't access the individual parts to perform formattin and conputations on them.
If there is a better method for completing this I am open to input! :-)
Function DBConnection(ByVal strUserName As String, ByVal strPassword As String) As Boolean
Try
SqlDataSource1.ConnectionString = MyConn.ConnectionString
SqlDataSource1.SelectCommand = "SELECT COUNT(*) AS Num_of_User FROM PID WHERE (PID = '" & strUserName & "') AND (PASSWORD = '" & strPassword & "');"
'If count = 1 Then
'Return True
'Else
'Return False
'End If
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
End Try
End Function