如下代码演示如何通过 Command 对象使用 Command 属性检索过程的参数信息。
Sub ProcedureParameters() Dim cnn As New ADODB.Connection Dim cmd As ADODB.Command Dim prm As ADODB.Parameter Dim cat As New ADOX.Catalog ' 打开连接 cnn.Open _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\Program Files\Microsoft Office\" & _ "Office\Samples\Northwind.mdb;" ' 打开目录 Set cat.ActiveConnection = cnn ' 获得命令对象 Set cmd = cat.Procedures("CustomerById").Command ' 检索参数信息 cmd.Parameters.Refresh For Each prm In cmd.Parameters Debug.Print prm.Name & ":" & prm.Type NextEnd Sub