Plue_41261h
New member
- Joined
- Oct 29, 2008
- Messages
- 3
- Programming Experience
- Beginner
I am very new in VB code and so currently i need to develop a simple login page but i do not know how to check the input by users. If u realise in my code i can only read one row of data in the table.
Is there any way to loop it or read all the rows ??? Thanks very much.
Is there any way to loop it or read all the rows ??? Thanks very much.
VB.NET:
Protected Sub BtnStaffLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
[COLOR="yellowgreen"]'Declare a ODBC Connection with the Connection String
'stored in the Web.Config File [/COLOR]
Dim strConn As System.Configuration.ConnectionStringSettings
strConn = ConfigurationManager.ConnectionStrings("ODBCDataConnectionString")
Dim conn As OdbcConnection = New OdbcConnection(strConn.ToString())
[COLOR="YellowGreen"] 'Every database operation requires a SQL Command
'Should specify a SELECT, INSERT, UPDATE or DELETE[/COLOR]
Dim cmd As New OdbcDataAdapter("Select * From Ticket", conn)
Dim SLogin As New DataSet
cmd.Fill(SLogin, "Staffinfo")
If SLogin.Tables("Staffinfo").Rows(0).Item("Username") = txtStaffUsername.Text Then
Response.Redirect("CreateTicket.aspx")
Else
lblMessage.Text = "Sorry wrong username and password"
End If
Last edited by a moderator: