|
Public Function GetNewConnection() As ADODB.Connection
Dim oCn As New ADODB.Connection
Dim sCnStr As String
sCnStr = "Provider='SQLOLEDB';Data Source='wangqiang';" & _
"Integrated Security='SSPI';Database='accesstata';user_id='sa';password='120979120979'"
oCn.Open sCnStr
If oCn.State = adStateOpen Then
Set GetNewConnection = oCn
End If
End Function
Private Sub Command6_Click()
Dim cn As New ADODB.Connection
Dim rx As ADODB.Recordset
Dim user_online As Integer
Dim user_id As Integer
Dim user_name As String
user_online = 0
Set cn = GetNewConnection
Set rx = New ADODB.Recordset
'On Error GoTo Err_Command6_Click
If IsNull(Text2) Or IsNull(Text4) Then
MsgBox "没有输入用户名或密码,请重新输入", vbInformation, "系统提示"
Exit Sub
End If
rx.Open ("select * from user_tbl where user_name=' " & Text2 & "' and user_password='" & Text4 & "'")
[ 本帖最后由 dreamice01 于 2008-2-27 09:39 编辑 ] |
|