⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login1.aspx

📁 用C#,VB和SQLSERVER编写的远程教学程序
💻 ASPX
字号:
<%@ Import NameSpace="System.Data.Oledb" %>
<%@ Import NameSpace="System.Data" %>
<HTML>
	<HEAD>
		<Title>欢迎登陆本网站!</Title>
		<Script Language="VB" runat="server">
Sub Page_load(sender as object,e as eventargs)
End Sub
Sub Button1_click(sender As object,e As EventArgs)
   Dim conn As OledbConnection   '声明一个OledbConnection对象
    conn=New OledbConnection()    '建立一个oledbConnection对象
    '设定连接字符串ConnectionString
    'conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & _
    ' "Data Source=" & Server.MapPath("user.mdb")
     conn.ConnectionString="Provider=SQLOLEDB.1;server=SONGWEI;database=vodweb;uid=sa;pwd=sql"
    conn.Open()
    Dim Cmd As oledbCommand  '声明一个Command对象
    '建立Command对象,并且指定SQL语句
    Dim SQLStr As string
    SQLStr="Select * From reg where userid='" & username.text & "'and password='"& password.text &"'"
    Cmd=New OledbCommand(SQLStr,conn)
    Dim rd As OledbDataReader   '声明一个DataReader对象
    rd=Cmd.ExecuteReader()   '执行SQL指令,并将其结果设定给DataReader
    If rd.Read() then
       Response.Redirect("index.aspx")
      Else
         Response.Write("用户名或密码不正确,请重新输入!")
    End If
End Sub

Sub Button2_click(sender As object,e As EventArgs)
   Dim conn As OledbConnection   '声明一个OledbConnection对象
    conn=New OledbConnection()    '建立一个oledbConnection对象
    '设定连接字符串ConnectionString
    'conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & _
    ' "Data Source=" & Server.MapPath("user.mdb")
     conn.ConnectionString="Provider=SQLOLEDB.1;server=SONGWEI;database=vodweb;uid=sa;pwd=sql"
    conn.Open()
    Dim Cmd As oledbCommand  '声明一个Command对象
    '建立Command对象,并且指定SQL语句
    Dim SQLStr As string
    SQLStr="Select * From admin where userid='" & username1.text & "'and password='"& password1.text &"'"
    Cmd=New OledbCommand(SQLStr,conn)
    Dim rd As OledbDataReader   '声明一个DataReader对象
    rd=Cmd.ExecuteReader()   '执行SQL指令,并将其结果设定给DataReader
    If rd.Read() then
       Response.Redirect("index1.aspx")
      Else
         Response.Write("用户名或密码不正确,请重新输入!")
    End If
End Sub
		</Script>
	</HEAD>
	<Body text="darkblue" background="image/wjjs_02.jpg">
		欢迎您登陆本网站! 用户登陆
		<Form runat="Server" ID="Form1">
			<asp:Panel id="step1" runat="server" BackColor="MistyRose" Height="208px">
请输入用户名字和密码,如您还未注册请先<A href="register1.aspx">注册</A>: 
<BLOCKQUOTE>用户姓名:
					<asp:textbox id="username" runat="Server"></asp:textbox>
					<P>用户密码:
						<asp:textbox id="password" runat="Server" TextMode="Password"></asp:textbox>
						<asp:RegularExpressionValidator id="Valid2" runat="server" ValidationExpression="[a-zA-Z0-9]{1,6}" ControlToValidate="password">
     (请输入1~6位密码)
</asp:RegularExpressionValidator><BR>
						<INPUT id="Button1" type="button" size="50" value="确 定" name="Button1" runat="Server" OnServerClick="Button1_Click"></P>
				</BLOCKQUOTE>
</asp:Panel>
			<P>管理员登陆:
			</P>
			<asp:Panel id="step2" runat="server" BackColor="Lavender" Height="237px">
请输入用户名字和密码</A>: 
<BLOCKQUOTE>用户姓名:
					<asp:textbox id="username1" runat="Server"></asp:textbox>
					<P>用户密码:
						<asp:textbox id="password1" runat="Server" TextMode="Password"></asp:textbox>
						<asp:RegularExpressionValidator id="Regularexpressionvalidator1" runat="server" ValidationExpression="[a-zA-Z0-9]{1,6}"
							ControlToValidate="password">
     (请输入1~6位密码)
</asp:RegularExpressionValidator><BR>
						<INPUT id="Button2" type="button" size="40" value="确 定" name="Button2" runat="Server" OnServerClick="Button2_Click">
					</P>
				</BLOCKQUOTE>
</asp:Panel>
		</Form>
	</Body>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -