Function FillAdminAccount() As Boolean
FillAdminAccount = True
Try
SQLconn.ConnectionString = "connect timeout=9999999;" & _
"data source=" & DefaultIserver & ";" & _
"initial catalog=" & DefaultIdBase & "; " & _
"user id=userid;" & _
"password=userpass;" & _
"persist security info=True; " & _
"packet size=4096"
SQLconn.Open()
SQLcmd.CommandType = CommandType.Text
SQLcmd.CommandText = "Select distinct username, cast(convert(varchar,userpassword) as varchar) as 'userpassword' from " & tblUsersList & " where usertype='MainAdmin'"
SQLcmd.Connection = SQLconn
SQLreader = SQLcmd.ExecuteReader
While SQLreader.Read = True
CurrentAdminUser = SQLreader("username").ToString
CurrentAdminPass = SQLreader("userpassword").ToString 'PROBLEM'
End While
Catch ex As Exception
ErrorMessage(ex)
Finally
If SQLconn.State = ConnectionState.Open Then SQLconn.Close()
If SQLreader.IsClosed = False Then SQLreader.Close()
End Try
End Function 'FillAdminAccount
Please see the line with the comment PROBLEM. On this code, the output is equal to "userpassword. As you can see, there is no quotation mark on the right and I wonder why. By the way, the data type of the userpassword in the database is BINARY. Wish you could help me on this. Thank you..x_x