| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 457 人关注过本帖
标题:[求助]ADO连接出错,
只看楼主 加入收藏
cseek
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-6-1
收藏
 问题点数:0 回复次数:1 
[求助]ADO连接出错,

运行程序的时候显示:ado无效文件名..


Private Sub cmdok_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现取消窗体置前的功能
On Error Resume Next
Dim MPassword As String
Dim Name1 As String
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "输入用户名或密码不能为空,请您确认后重新输入", , "天启人事管理系统"
End If
Text1.Text = ""
Text1.SetFocus

If Trim(Text1.Text) = "pengpeng" And Trim(Text2.Text) = "16682589" Then '判断是否使用的是超级口令登录
tq_main.StatusBar1.Panels.Item(2).Text = "当前操作员:pengpeng"

Unload Me
tq_main.Show
Else
Adodc1.RecordSource = "select * from login where use_id ='" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("password")
If Text2.Text = MPassword Then '判断数据的密码是否正确
tq_main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("use_id")

frm_main.Show

Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "天启人事管理系统"
Text1.Text = ""
Text1.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "天启人事管理系统"
Text2.Text = ""
Text1.Text = ""
End If
End If
End Sub

Private Sub cmdend_Click()
End
End Sub

Private Sub Form_Load()
If App.PrevInstance Then
MsgBox "您已经启动了本程序"
End
End If
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现使窗体置前的功能
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:" & App.Path & "\data\ppdata.mdb;Persist Security Info=False"

Adodc1.RecordSource = "select * from login"

Adodc1.CommandType = adCmdText
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
End If

End Sub
Private Sub ScreenCenter()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call cmdok_Click
End If
End Sub

搜索更多相关主题的帖子: ADO 
2007-06-01 16:35
Joforn
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1242
专家分:122
注 册:2007-1-2
收藏
得分:0 
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:" & App.Path & "\data\ppdata.mdb;Persist Security Info=False"

把这条改成
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & iif(right(App.Path,1)="\",app.path,app.path & "\") & "data\ppdata.mdb;Persist Security Info=False"
试试,不过前提是你的那个ppdata.mdb保存在你程序所在目录中的data目录下。

VB QQ群:47715789
2007-06-01 17:22
快速回复:[求助]ADO连接出错,
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015891 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved