Monday, February 20, 2012

Login Page

Hi,

i created my own table.it includes usr_name,usr_surname,usr_email,usr_password

and i have login form.it includes 2 texboxes.1 for login(email) and the other for password.How can i query the user on database if user on db and his password matches with his username.dont advice me to try asp.net membership please..i want to create my own.i am using sql,asp.net codebehind:vb.
if you give example with stored procedure it can be more useful for me.

thanks,

create procedure [dbo].[login_verify](@.user varchar(30),@.pwd varchar(20),@.msg varchar(30)
out) as
select @.user=username,@.pwd=password from users where username=@.user and
password=@.pwd
if @.@.rowcount=0
set @.msg='Invalid User or Pasword'
else
set @.msg='Hello world'

or

in aspx page

Function login_verify(ByVal user As String, ByVal pwd As String) As Boolean
con = New SqlConnection
con.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
st = "select username,password from users where username =" & "'" & user & "'" & " and password= " & "'" & pwd & "'"
cmd = New SqlCommand(st, con)
Try
con.Open()
dr = cmd.ExecuteReader
dr.Read()
If dr(0) = user And dr(1) = pwd Then Return True Else Return False
Catch ex As Exception
Response.Write("Invalid Login or Password")
End Try
con.Close()
End Function

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.

|||

Hi there,

take a look at this article I think it can be helpful.

http://support.microsoft.com/kb/910440

Regards,

Fernando

|||

thnx

No comments:

Post a Comment