VB 如何通过Adodc或Adodb获取Access表中的主健字段
DimadocnAsNewADODB.Connectionadocn.ConnectionString="provider=microsoft.jet.oledb.4.0...
Dim adocn As New ADODB.Connection
adocn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\公司数据库.mdb" & _
";persist security info =false; Jet OLEDB:Database Password=accent" '---------------带密码的连接
Dim rs As New ADODB.Recordset
Dim strSql As String
strSql = "select 主键 from 订单表"
If adocn.State = adStateOpen Then
adocn.Close
adocn.Open
Else
adocn.Open
End If
rs.Open strSql, adocn, 1, 1
Dim FF As String
FF = rs.Fields("主键") 展开
adocn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\公司数据库.mdb" & _
";persist security info =false; Jet OLEDB:Database Password=accent" '---------------带密码的连接
Dim rs As New ADODB.Recordset
Dim strSql As String
strSql = "select 主键 from 订单表"
If adocn.State = adStateOpen Then
adocn.Close
adocn.Open
Else
adocn.Open
End If
rs.Open strSql, adocn, 1, 1
Dim FF As String
FF = rs.Fields("主键") 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询