如下代码演示如何使用 Command 属性更新过程文本。
Sub ProcedureText() Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim cmd As New ADODB.Command ' 打开连接 cnn.Open _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\Program Files\Microsoft Office\" & _ "Office\Samples\Northwind.mdb;" ' 打开目录 Set cat.ActiveConnection = cnn ' 获得 Command Set cmd = cat.Procedures("CustomerById").Command ' 更新 CommandText cmd.CommandText = "Select CustomerId, CompanyName, ContactName " & _ "From Customers " & _ "Where CustomerId = [CustId]" ' 更新过程 Set cat.Procedures("CustomerById").Command = cmdEnd Sub