标题:请教一个VB与ACCESS数据库连接的问题,谢谢了
取消只看楼主
lawless
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-4-29
 问题点数:0 回复次数:0 
请教一个VB与ACCESS数据库连接的问题,谢谢了

小第想用VB编程把不同组的数据写入数据库不同的表中,部分程序如下,但不行,请问我这段程序错在那了????谢谢!

Private myrs As New ADODB.Recordset
Private mycon As New ADODB.Connection

Dim strConn As String

If st = "59280" Then

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\shujuku.mdb;Persist Security Info=False"

mycon.CursorLocation = adUseClient

mycon.Open strConn

myrs.Open "Select * from qywd", mycon, adOpenKeyset, adLockOptimistic

Set DataGrid1.DataSource = myrs

ElseIf st = "59087" Then

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\shujuku.mdb;Persist Security Info=False"

mycon.CursorLocation = adUseClient

mycon.Open strConn

myrs.Open "Select * from fgwd", mycon, adOpenKeyset, adLockOptimistic

Set DataGrid1.DataSource = myrs

End If

搜索更多相关主题的帖子: 数据库 ACCESS Microsoft strConn 
2007-04-29 17:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-136009-1-1.html




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

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