VB连接DB数据库数据库连接:strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data" & ";Mode=ReadWrite|Share Deny None;Persist Security Info=False;Jet OLEDB:Engine Type=82"ConSql.ConnectionString = strConnConSql.Open……打开数据库:sql = "select * from data"rs.Open sql, ConSql, adOpenStatic, adLockReadOnly这时,如果data.db被别的打开时,VB打开时就会出现:“无法锁定数据表data;正被机器 '(未知)' 上的用户 '(未知)' 使用。”请问这如何解决?
1 回答
慕森卡
TA贡献1806条经验 获得超8个赞
'记得引用Microsoft Active....2.6/2.8组件
Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim constr As String
Dim sqlstr As String
constr = "driver=;server=100.1.106.10;uid=sa;pwd=admin228314;database=te"
con.ConnectionString = constr
con.Open
sqlstr = "select * from menu"
rs.Open sqlstr, con, adOpenStatic, adLockOptimistic
'rs.AddNew
Set DataGrid1.DataSource = rs
Me.DataGrid1.Refresh
End Sub
- 1 回答
- 0 关注
- 1127 浏览
添加回答
举报
0/150
提交
取消