---------------------登陆代码如下------------
Private Sub XPButton1_Click()
Dim rs As New ADODB.Recordset
Dim mystr As String
Dim str As String
mystr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=wenxeeian;Initial Catalog=student"
If user.Text = "" Then
MsgBox "用户名不能为空!", vbOKOnly + vbInformation, "友情提示"
user.SetFocus
Exit Sub
End If
If pwd.Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbInformation, "友情提示"
pwd.SetFocus
Exit Sub
End If
str = "select * from StudentInfo where 学号='" & Trim(user.Text) & "' and 密码='" & Trim(pwd.Text) & "'"
rs.Open str, mystr, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Form2.Show
Unload Me
Else
a = MsgBox("您输入的用户名或密码有误", 1 + 16, "错误")
user.SetFocus
Exit Sub
End If ------------------------form2代码-----------
请问要怎么才能得到这个“学生”的资料?
里面有学号,姓名,专业,性别,出生日期
我不懂要怎么写(((主要问题在于我区别不开ASP和VB,ASP可以引用相pwd=replace(trim(Request("pwd")),"'","")这类,
---------有心的人帮我在form2写个完整的代码吧--------------
谢谢,我会努力的
Private Sub XPButton1_Click()
Dim rs As New ADODB.Recordset
Dim mystr As String
Dim str As String
mystr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=wenxeeian;Initial Catalog=student"
If user.Text = "" Then
MsgBox "用户名不能为空!", vbOKOnly + vbInformation, "友情提示"
user.SetFocus
Exit Sub
End If
If pwd.Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbInformation, "友情提示"
pwd.SetFocus
Exit Sub
End If
str = "select * from StudentInfo where 学号='" & Trim(user.Text) & "' and 密码='" & Trim(pwd.Text) & "'"
rs.Open str, mystr, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Form2.Show
Unload Me
Else
a = MsgBox("您输入的用户名或密码有误", 1 + 16, "错误")
user.SetFocus
Exit Sub
End If ------------------------form2代码-----------
请问要怎么才能得到这个“学生”的资料?
里面有学号,姓名,专业,性别,出生日期
我不懂要怎么写(((主要问题在于我区别不开ASP和VB,ASP可以引用相pwd=replace(trim(Request("pwd")),"'","")这类,
---------有心的人帮我在form2写个完整的代码吧--------------
谢谢,我会努力的
定義幾個全局變量可以了