Dim StrUser As String, StrPass As String
Dim BValid As Boolean
Dim Conn As Data.SqlClient.SqlConnection
Dim strCommand As Data.SqlClient.SqlCommand
Dim strReader As Data.SqlClient.SqlDataReader
Dim StrSQL As String
StrUser = txtUser.Text
StrPass = txtPass.Text
BValid = False
Conn = New Data.SqlClient.SqlConnection("Data Source=xxxx; Initial
Catalog=xxxx; User ID=xxx; Password=xxxx")
StrSQL = "SELECT * FROM Users WHERE UserName='" & StrUser & "' and
password='" & StrPass & "'"
strCommand = New Data.SqlClient.SqlCommand(StrSQL, Conn)
Conn.Open()
Response.Write(StrSQL)
strReader = strCommand.ExecuteReader()
While strReader.Read()
If strReader("UserName") <> "" And strReader("Password") <> ""
Then
'Response.Cookies("ValidUser").Value = strReader("UserName")
'Response.Cookies("ValidUser").Expires =
DateTime.Now.AddMonths(1)
BValid = True
Else
BValid = False
End If
End While
If BValid = True Then
Response.Redirect("default.aspx")
ElseIf BValid = False Then
LblError.Text = "Login Error: Please try again."
End If
Conn.Close()
"XD" <reply...@hotmail.com> wrote in message
news:eevzWezs...@TK2MSFTNGP02.phx.gbl...
"XD" <reply...@hotmail.com> wrote in message
news:ujpSkX0s...@TK2MSFTNGP06.phx.gbl...