Private Sub send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles send.Click
If username.Text = "" And password.Text = "" Then
Response.Write("<script language=javascript>alert('请输入用户名,密码')</script>")
Else
If username.Text = "" Then
Response.Write("<script language=javascript>alert('请输入用户名')</script>")
Else
If password.Text = "" Then
Response.Write("<script language=javascript>alert('请输入密码')</script>")
End If
End If
End If
If username.Text <> "" And password.Text <> "" Then
Call binddata()
End If
End Sub
Sub binddata()
Dim conn As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("wwwlink.mdb"))
conn.Open()
Dim strsql As String
strsql = "select * from infor where username='" & username.Text & "'and passworda= '" & password.Text & "'"
Dim cmd As New OleDbCommand(strsql, conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader()
If dr.Read() = True Then
conn.Close()
Response.Redirect("index.aspx")
Else
conn.Close()
Response.Write("<script language=javascript>alert('用户名或密码不正确!');</script>")
End If
conn.Close()
End Sub
用ASP.NET+access编写的。你把数据库改了就可以用了。