设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2183|回复: 0
打印 上一主题 下一主题

(已解决)这种数据的连接是怎么写来着,怎么老报错?说什么连接字符串属性无效

[复制链接]
跳转到指定楼层
1#
发表于 2008-2-3 15:22:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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 编辑 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-16 14:49 , Processed in 0.082950 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表