和查询相关的代码是:
Dim ConnStr As String
ConnStr = "Data Source=localhost;Integrated Security=SSPI;"
ConnStr = ConnStr + "Initial Catalog=CombNetCoreDB2" Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConnStr) Try
conn.Open()
If conn.State = ConnectionState.Open Then
Dim CmdStr As String
If RadioButton1.Checked = True Then
CmdStr = "Select userid from login_table where user_name='" & _
Trim(CType(UserName.Text, String)) & "' " & _
"and password='" & Trim(CType(uPassword.Text, String)) & _
"' " & "and user_mode=0;" Else CmdStr = "Select userid from login_table where user_name='" & _
Trim(CType(UserName.Text, String)) & "' " & _
"and password='" & Trim(CType(uPassword.Text, String)) & "' " & _
"and user_mode=1;" End If Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(CmdStr, conn) Dim sqlReader1 As SqlClient.SqlDataReader = cmd.ExecuteReader()
Dim ConnStr As String
ConnStr = "Data Source=localhost;Integrated Security=SSPI;"
ConnStr = ConnStr + "Initial Catalog=CombNetCoreDB2" Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConnStr) Try
conn.Open()
If conn.State = ConnectionState.Open Then
Dim CmdStr As String
If RadioButton1.Checked = True Then
CmdStr = "Select userid from login_table where user_name='" & _
Trim(CType(UserName.Text, String)) & "' " & _
"and password='" & Trim(CType(uPassword.Text, String)) & _
"' " & "and user_mode=0;" Else CmdStr = "Select userid from login_table where user_name='" & _
Trim(CType(UserName.Text, String)) & "' " & _
"and password='" & Trim(CType(uPassword.Text, String)) & "' " & _
"and user_mode=1;" End If Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(CmdStr, conn) Dim sqlReader1 As SqlClient.SqlDataReader = cmd.ExecuteReader()
Session(sqlReader1.Item("userid")) = sqlReader1.Item("userid")
Session(sqlReader1.Item("userid")) = sqlReader1.Item("userid")