Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim connection As SqlConnection = New SqlConnection("server=(local); Database = Bookstore; integrated Security=True")
Dim CSP As SqlCommand = New SqlCommand()
'Dim Cust As SqlCommand = New SqlCommand()

CSP.Connection = connection
CSP.CommandText = ("select CusID,CusPassword from CusromerDetail where CusUsername = " & "'" & txtUserName.Text & "' and CusPassword = '" & txtUserPass.Text & "'")

'Cust.Connection = connection
'Cust.CommandText = ("select CustEmail,CustPassword from Customer where CustEmail = " & "'" & txtUserName.Text & "' and CustPassword = '" & txtUserPass.Text & "'")

connection.Open()

If txtUserName.Text.StartsWith("cs") Then
Dim csr As SqlDataReader = CSP.ExecuteReader
If csr.Read = True Then
Session.Contents("username") = txtUserName.Text
Response.Redirect("AboutUs.aspx")
Else
Response.Redirect("Login.aspx")
End If
End If
connection.Close()
End Sub

Recommended Answers

All 3 Replies

thx i just change my server name.

cool... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.