does anyone know whats wrong with my code?
Private Function check_login(ByVal login As String) As String
dim dbCon As SqlConnection = New SqlConnection
Dim dbCmd As SqlCommand = New SqlCommand
Dim returnuser As Integer
dbCon.ConnectionString = _
"Data Source=localhost;" + _
"Initial Catalog=registeruser;" + _
"User ID=int422;" + _
"Password=int422"
dbCon.Open()
dbCmd.Connection = dbCon
dbCmd.CommandText = "SELECT count(login_id) from users where login_id=@.login"
dbCmd.CommandType = CommandType.Text
returnuser = dbCmd.ExecuteScalar
Return returnuser
dbCon.Close()
SELECT count(login_id) from users where login_id=@.login
I don't see where you are setting the value for the @.login parameter. Also the dbCon.Close() should be immediately after the ExecuteScalar() call and, in particular, before the return statement.
No comments:
Post a Comment