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
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