N
nicholas
I want to check if a userlogin already exists, so this is what i did...but
it is not working and I just can't get it to work. Must be something
stupid, but I don't see it ;-)
(I don't get any error, it just doesn't work)
STORED PROCEDURE:
==================
CREATE PROCEDURE sp_select_userlogin
@userlogin nvarchar
AS
SELECT userlogin FROM tbl_users WHERE userlogin = @userlogin
GO
CODE ON ASPX PAGE on mybutton click :
===============================
'define where the connectionstring is here:
Dim MyConnectionString as String =
ConfigurationSettings.AppSettings("ConnectionString")
Dim ObjReader as SQLDataReader
'make the connection
Dim MyConnection as New
SQLConnection(MyConnectionString)
Dim ObjCmd as SQLCommand= New
SQLCommand("sp_select_userlogin",MyConnection)
ObjCmd.CommandType = CommandType.StoredProcedure
' Set up parameter for stored procedure
ObjCmd.Parameters.Add(New SqlParameter("@userlogin",
SqlDbType.NVarChar, 50))
ObjCmd.Parameters("@userlogin").Value = userlogin.text
Dim daLogins As New SqlDataAdapter(ObjCmd)
Dim dsLogins As New DataSet()
If dsLogins.Tables.Count = 0 Then
lbl_user_allready_exists.visible = false
Else
lbl_user_allready_exists.visible = true
End If
ObjCmd.Connection.Close()
it is not working and I just can't get it to work. Must be something
stupid, but I don't see it ;-)
(I don't get any error, it just doesn't work)
STORED PROCEDURE:
==================
CREATE PROCEDURE sp_select_userlogin
@userlogin nvarchar
AS
SELECT userlogin FROM tbl_users WHERE userlogin = @userlogin
GO
CODE ON ASPX PAGE on mybutton click :
===============================
'define where the connectionstring is here:
Dim MyConnectionString as String =
ConfigurationSettings.AppSettings("ConnectionString")
Dim ObjReader as SQLDataReader
'make the connection
Dim MyConnection as New
SQLConnection(MyConnectionString)
Dim ObjCmd as SQLCommand= New
SQLCommand("sp_select_userlogin",MyConnection)
ObjCmd.CommandType = CommandType.StoredProcedure
' Set up parameter for stored procedure
ObjCmd.Parameters.Add(New SqlParameter("@userlogin",
SqlDbType.NVarChar, 50))
ObjCmd.Parameters("@userlogin").Value = userlogin.text
Dim daLogins As New SqlDataAdapter(ObjCmd)
Dim dsLogins As New DataSet()
If dsLogins.Tables.Count = 0 Then
lbl_user_allready_exists.visible = false
Else
lbl_user_allready_exists.visible = true
End If
ObjCmd.Connection.Close()