Forum Moderators: open
<code>Sub Login_Click(Sender As Object, E As EventArgs)
If Page.IsValid Then
Dim userDS As New DataSet
userDS = QueryMethod(UserName.Text, UserPass.Text)
If userDS.Tables(0).Rows.Count = 1 Then
FormsAuthentication.RedirectFromLoginPage(UserName.Text, True)
Else
Msg.Text = "Invalid Credentials : Please try again"
End If
En If
End Sub
Function QueryMethod(ByVal username As String, ByVal password As String) As DataSet
Dim connectionString As String = "server........"
Dim sqlConnection As sqlConnection = New sqlConnection(connectionString)
Dim queryString As String = "SELECT [tusers].* FROM [tusers] WHERE (([tusers].[username] = @username) AND ([tusers].[userpassword] = @userpassword))"
sqlCommand.Parameters.Add("@username", sqldbType.VarChar).value= username
sqlCommand.Parameters.Add("@userpassword", sqldbType.VarChar).value = password
Dim dataAdapter As sqlDataAdapter = New sqlDataAdapter(sqlCommand)
Dim dataSet As DataSet = New DataSet
dataAdapter.Fill(dataSet)
Return dataSet
End Function
</code>
Like I said, my main problem seems to be understanding the transfer of the data from the database to the program. Thanks for any help.
John
In your global.asa create a OnSession_Start Function. In there you can set a variable called WIDGET as empty by doing the following:
Widget = ""
To fill this in your code you will just use the following:
Session("Widget") = "25-Jan-03"
And you can access it with
<%= Session("Widget") %>
Hope this helps in some way.
Chris