Hello all,
I have created a succesful login, that verifies users email and password. Once the user logs in, i want a table displaying all the current users who are logged on using a dynamic table. I have made a start with the table, but i dont know how to display the current users who are logged on.
This is what i have done:
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.Connection = SqlConnection1
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * " 'Forename, Surname, Password,ID
cmd.CommandText &= "FROM Schoolmates "
'cmd.CommandText &= "WHERE Email ='" & UCase(Trim(txtEmail.Text)) & "'"
'cmd.CommandText &= "And Password ='" & UCase(Trim(txtPassword.Text)) & "'"
Dim dsAdapter As New SqlDataAdapter
Dim dsDataset As New DataSet
dsAdapter.SelectCommand = cmd
dsAdapter.Fill(dsDataset)
Response.Write("Number of rows:" & dsDataset.Tables(0).Rows.Count)
Dim rowNumber As Int16
For rowNumber = 0 To dsDataset.Tables(0).Rows.Count - 1
If UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Email")) = UCase(Trim(txtEmail.Text)) AndAlso UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Password")) = UCase(Trim(txtPassword.Text)) Then
Response.Write("User's surname " & dsDataset.Tables(0).Rows(rowNumber).Item("Surname") & "<BR>")
Else
Response.Write("Password you entered was incorrect." & dsDataset.Tables(0).Rows(rowNumber).Item("email") & "<BR>")
End If
Next rowNumber
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<Table border=1><tr><td>Fore Name</td><td>Sur Name</td><td>Phone</td><td>Email</td></tr>")
Response.Write("<tr>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Forename") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Surname") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Telephone") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Email") & "</td></tr>")
Response.Write("</table>")
SqlConnection1.Close()
SqlConnection1 = Nothing
End Sub
I thank you all you experts in advance.
I have created a succesful login, that verifies users email and password. Once the user logs in, i want a table displaying all the current users who are logged on using a dynamic table. I have made a start with the table, but i dont know how to display the current users who are logged on.
This is what i have done:
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.Connection = SqlConnection1
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * " 'Forename, Surname, Password,ID
cmd.CommandText &= "FROM Schoolmates "
'cmd.CommandText &= "WHERE Email ='" & UCase(Trim(txtEmail.Text)) & "'"
'cmd.CommandText &= "And Password ='" & UCase(Trim(txtPassword.Text)) & "'"
Dim dsAdapter As New SqlDataAdapter
Dim dsDataset As New DataSet
dsAdapter.SelectCommand = cmd
dsAdapter.Fill(dsDataset)
Response.Write("Number of rows:" & dsDataset.Tables(0).Rows.Count)
Dim rowNumber As Int16
For rowNumber = 0 To dsDataset.Tables(0).Rows.Count - 1
If UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Email")) = UCase(Trim(txtEmail.Text)) AndAlso UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Password")) = UCase(Trim(txtPassword.Text)) Then
Response.Write("User's surname " & dsDataset.Tables(0).Rows(rowNumber).Item("Surname") & "<BR>")
Else
Response.Write("Password you entered was incorrect." & dsDataset.Tables(0).Rows(rowNumber).Item("email") & "<BR>")
End If
Next rowNumber
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<Table border=1><tr><td>Fore Name</td><td>Sur Name</td><td>Phone</td><td>Email</td></tr>")
Response.Write("<tr>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Forename") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Surname") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Telephone") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Email") & "</td></tr>")
Response.Write("</table>")
SqlConnection1.Close()
SqlConnection1 = Nothing
End Sub
I thank you all you experts in advance.