Sub test1()
Dim Cat As New ADOX.Catalog
Dim Cmd As New ADODB.Command
Dim Tmp_i As Integer
Set Cat.ActiveConnection = CurrentProject.Connection
For Tmp_i = 0 To Cat.Procedures.Count
Debug.Print Cat.Procedures(Tmp_i).Name
Set Cmd = Cat.Procedures(Tmp_i).Command
Debug.Print Cmd.CommandText
Next
End Sub
错误提示为:"不支持此接口",请高手解答,不胜感激![em06]作者: pangluo 时间: 2006-9-28 18:44
从目前了解到的情况来看,可能是SQL SERVER不支持访问command属性了,但如果我要生成动态的查询,如:
Set Qry = CurrentDb.QueryDefs("Temp")
Qry.sql = "SELECT A.包装物编码, A.包装物名称, A.单位 FROM 包装物 AS A" '该语句是动态的
Qry.Close
怎么办????期待高手指点![em06]
Dim cnn As New ADODB.Connection
Dim Cat As New ADOX.Catalog
Dim Cmd As New ADODB.Command
Dim Tmp_i As Integer
cnn.Open "rovider=Microsoft.Access.OLEDB.10.0;Data Source=AA\SONG;User ID=***assword=***;Initial Catalog=PX_Data;Data Provider=SQLOLEDB.1"
Set Cat.ActiveConnection = cnn
For Tmp_i = 0 To Cat.Procedures.Count
Debug.Print Cat.Procedures(Tmp_i).Name
Set Cmd = Cat.Procedures(Tmp_i).Command
Debug.Print Cmd.CommandText
Next