Imports System.Data
Imports System.Data.SqlClient
Partial Class login
Inherits System.Web.UI.Page
Public constr As String
Public ds As New DataSet()
Public da As SqlClient.SqlDataAdapter
Public mySqlConn1 As New SqlClient.SqlConnection(constr)
Public sql, sql1, code, asd, type, cartno As String
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim conn As New SqlConnection
Dim constr As String
constr = "Data Source=.\SQLEXPRESS;AttachDbFilename=c:\citypilot\App_Data\regdb.mdf;Integrated Security=true;User Instance=true"
conn.ConnectionString = constr
conn.Open()
sql = "select * from log where user_id='" & Login1.UserName.ToString & "' and password='" & Login1.Password.ToString & "'"
Dim comm As New SqlCommand(sql, conn)
Dim type As String
Dim dr As SqlDataReader
dr = comm.ExecuteReader
Dim a As Integer
If dr.Read() = True Then
a = 1
type = dr.GetString(2)
Else
a = 0
End If
dr.Close()
If a = 1 Then
Session("Userid") = Login1.UserName.ToString
If (String.Compare(type.Trim(), "business") = 0) Then
Response.Redirect("hupdate.aspx")
ElseIf (String.Compare(type.Trim(), "Emergency") = 0) Then
Response.Redirect("jupdate.aspx")
End If
Else
MsgBox("Enter Valid User Name and Password!")
End If
conn.Close()
End Sub
End Class
Imports System.Data.SqlClient
Partial Class login
Inherits System.Web.UI.Page
Public constr As String
Public ds As New DataSet()
Public da As SqlClient.SqlDataAdapter
Public mySqlConn1 As New SqlClient.SqlConnection(constr)
Public sql, sql1, code, asd, type, cartno As String
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim conn As New SqlConnection
Dim constr As String
constr = "Data Source=.\SQLEXPRESS;AttachDbFilename=c:\citypilot\App_Data\regdb.mdf;Integrated Security=true;User Instance=true"
conn.ConnectionString = constr
conn.Open()
sql = "select * from log where user_id='" & Login1.UserName.ToString & "' and password='" & Login1.Password.ToString & "'"
Dim comm As New SqlCommand(sql, conn)
Dim type As String
Dim dr As SqlDataReader
dr = comm.ExecuteReader
Dim a As Integer
If dr.Read() = True Then
a = 1
type = dr.GetString(2)
Else
a = 0
End If
dr.Close()
If a = 1 Then
Session("Userid") = Login1.UserName.ToString
If (String.Compare(type.Trim(), "business") = 0) Then
Response.Redirect("hupdate.aspx")
ElseIf (String.Compare(type.Trim(), "Emergency") = 0) Then
Response.Redirect("jupdate.aspx")
End If
Else
MsgBox("Enter Valid User Name and Password!")
End If
conn.Close()
End Sub
End Class
No comments:
Post a Comment