Click to See Complete Forum and Search --> : log in problem


Zouve
December 21st, 2006, 01:22 PM
i wanna to add a admin log in functions inside my website which is when administrator key in their name, password and their company then the function will try to search the same variable inside database and send the administrator to the right page when the log in is successful. i have try to code but the codes seems not working. can someone give me a hand? thanks

my code: (i try to match the administrator's Name)
Protected Sub logButt_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myadd As String
Dim myConnection As SqlConnection = New SqlConnection()
myConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString()

myadd = ("SELECT Adname FROM admin_info")
Dim myCommand As SqlCommand = New SqlCommand(myadd, myConnection)

myConnection.Open()
Dim dr As SqlDataReader = myCommand.ExecuteReader()

dr.Read()
If admintext.Text = myadd Then
Server.Transfer("res_sakura.aspx")
End If

myConnection.Close()
End Sub

MMH
December 22nd, 2006, 12:41 AM
Hi... r u able to retrive admin name properly frm da database ???
does da below code line give u da name u want ???


myadd = ("SELECT Adname FROM admin_info")



first check it out !!!
MMH

MMH
December 22nd, 2006, 12:51 AM
try out this code below !!


myadd = ("SELECT Adname FROM admin_info WHERE Adname=") + admintext.Text


MMH