最好不要使用控件绑定,可以用编程实现'与服务器系统数据库的连接
Dim StrCon As String
dim ac_Tmp as new adodb.connection
dim ar_Tmp as new adodb.recordset
StrCon = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;" _
& "Initial Catalog=数据库名;Data Source=" & 服务器名 & ";" _
& "Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;" _
& "Use Encryption for Data=False;Tag with column collation when possible=False"With Ac_tmp
If .State = adStateOpen Then .Close
.ConnectionString = StrCon
.ConnectionTimeout = 30
.Open
End Withwith ar_tmp
if .state=adstateopen then .close
.open "select * from tablename where username='"& usertxt.text &"' and password='"& passtxt.text &"'",ac_tmp,adopenkeyset,adlockreadonly
end withif ar_tmp.recordcount=0 then
msgbox "用户名或密码错误!",48,"提示"
ar_tmp.close
set ar_tmp=nothing
exit sub
endif
Dim StrCon As String
dim ac_Tmp as new adodb.connection
dim ar_Tmp as new adodb.recordset
StrCon = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;" _
& "Initial Catalog=数据库名;Data Source=" & 服务器名 & ";" _
& "Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;" _
& "Use Encryption for Data=False;Tag with column collation when possible=False"With Ac_tmp
If .State = adStateOpen Then .Close
.ConnectionString = StrCon
.ConnectionTimeout = 30
.Open
End Withwith ar_tmp
if .state=adstateopen then .close
.open "select * from tablename where username='"& usertxt.text &"' and password='"& passtxt.text &"'",ac_tmp,adopenkeyset,adlockreadonly
end withif ar_tmp.recordcount=0 then
msgbox "用户名或密码错误!",48,"提示"
ar_tmp.close
set ar_tmp=nothing
exit sub
endif
Set typer = phonedb.OpenRecordset(str, dbOpenDynaset)
If typer.RecordCount <> 0 Then
If text2.Text = typer!mima Then
user1 = text1.Text With typer
.Edit
!num = !num + 1
.Update
End With
num1 = typer!num
MsgBox "欢迎使用本系统", vbOKOnly, "输入"
Form1.Show
Unload Me
Else
MsgBox "口令有误!", vbOKOnly, "输入"
End If
Else
MsgBox "无此用户", vbOKOnly, "输入"
End If