本帖最后由 cheng5276 于 2011-12-29 00:10 编辑
泣血求教,恳请大侠们指点
在ACCESS中,可以直接通过"SELECT MSysObjects.Name FROM MsysObjects" sql语句来取得所有表名的列表
但是当通过LISP+ADO的以下两种方法时,都提示无此权限,恳请老大们指点!
(setq SqlString "SELECT MSysObjects.Name FROM MsysObjects")
1、方法一 (vlax-invoke-method RSObject "open" SqlString DBConnection nil nil adok-adcmdtext)
2、方法二 (vlax-invoke-method DBConnection "Execute" SqlString nil -1)
这个是网上的一段VB代码,本想参照这个改写
3、方法三 (setq rs (Vlax-Invoke-Method DBConnection "OpenSchema" adSchemaTables)) 提示“无效的参数数目”
-
- Private Sub Form_Load()
- Dim adoCN As New ADODB.Connection '定义数据库的连接存放数据和代码Dim rstSchema
- Dim strCnn As New ADODB.Recordset
-
- str1 = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=wktrade;Data Source=net5 "
- adoCN.Open str1
-
- Set rstSchema = adoCN.OpenSchema(adSchemaTables)
-
- Do Until rstSchema.EOF
- out = out & "Table name: " & _
- rstSchema!TABLE_NAME & vbCr & _
- "Table type: " & rstSchema!TABLE_TYPE & vbCr
- rstSchema.MoveNext
- Loop
- rstSchema.Close
-
- adoCN.Close
- Debug.Print out
- End Sub
|