Microsoft KB Archive/253627: Difference between revisions
m (Text replacement - "&" to "&") |
m (Text replacement - """ to """) |
||
Line 83: | Line 83: | ||
<BODY> | <BODY> | ||
<%@ Language=VBScript %> | <%@ Language=VBScript %> | ||
<!-- #INCLUDE VIRTUAL= | <!-- #INCLUDE VIRTUAL="/ADOVBS.INC" --> | ||
<% | <% | ||
Dim adoConnection | Dim adoConnection | ||
Line 92: | Line 92: | ||
'JetOLEDB4.0 | 'JetOLEDB4.0 | ||
adoConnectString= | adoConnectString="Provider=Microsoft.JET.OLEDB.4.0;" & _ | ||
"Data Source=D:\inetPub\wwwRoot\Databases\Northwind.mdb;" & _ | |||
"User ID=Admin;Password=;" | |||
Set adoConnection = CreateObject( | Set adoConnection = CreateObject("adodb.connection") | ||
With adoConnection | With adoConnection | ||
.CursorLocation = adUseClient | .CursorLocation = adUseClient | ||
Line 102: | Line 102: | ||
End With | End With | ||
strSQLCreateProc = | strSQLCreateProc = "Create Procedure uspInsertShipper(" & _ | ||
"@parm1 VarChar(40)," & _ | |||
"@parm2 VarChar(24))" & _ | |||
"as " & _ | |||
"INSERT INTO Shippers (CompanyName, Phone)" & _ | |||
"VALUES(@parm1, @parm2)" | |||
strSQLDropProc = | strSQLDropProc = "Drop Procedure uspInsertShipper" | ||
On Error Resume Next | On Error Resume Next | ||
Line 117: | Line 117: | ||
'* Comment this code (And uncomment the AdoX code below) to fix the error. | '* Comment this code (And uncomment the AdoX code below) to fix the error. | ||
Set adoCommand = CreateObject( | Set adoCommand = CreateObject("adodb.command") | ||
Set adoCommand.ActiveConnection = adoConnection | Set adoCommand.ActiveConnection = adoConnection | ||
adoCommand.CommandText = | adoCommand.CommandText = "uspInsertShipper" | ||
adoCommand.CommandType = adCmdStoredProc | adoCommand.CommandType = adCmdStoredProc | ||
adoCommand.Parameters.Append adoCommand.CreateParameter( | adoCommand.Parameters.Append adoCommand.CreateParameter("parm1", adVarWChar, adParamInput, 40) | ||
adoCommand.Parameters.Append adoCommand.CreateParameter( | adoCommand.Parameters.Append adoCommand.CreateParameter("parm2", adVarWChar, adParamInput, 24) | ||
adoCommand.Parameters.Refresh | adoCommand.Parameters.Refresh | ||
'* Uncomment this code (And comment the AdoDb code above) to fix the error. | '* Uncomment this code (And comment the AdoDb code above) to fix the error. | ||
'Set adoCatalog = CreateObject( | 'Set adoCatalog = CreateObject("adox.catalog") | ||
'Set adoCatalog.ActiveConnection = adoConnection | 'Set adoCatalog.ActiveConnection = adoConnection | ||
'Set adoCommand = adoCatalog.Procedures( | 'Set adoCommand = adoCatalog.Procedures("uspInsertShipper").Command | ||
'adoCommand.Parameters.Append adoCommand.CreateParameter( | 'adoCommand.Parameters.Append adoCommand.CreateParameter("parm1", adVarWChar, adParamInput, 40) | ||
'adoCommand.Parameters.Append adoCommand.CreateParameter( | 'adoCommand.Parameters.Append adoCommand.CreateParameter("parm2", adVarWChar, adParamInput, 24) | ||
'adoCommand.Parameters.Refresh | 'adoCommand.Parameters.Refresh | ||
Response.Write | Response.Write "The parameter properties for uspInsertShipper: " & "<br>" _ | ||
& | & "Name: " & adoCommand.Parameters(0).Name & "<br>" _ | ||
& | & "Type: " & adoCommand.Parameters(0).Type & "<br>" _ | ||
& | & "Direction: " & adoCommand.Parameters(0).Direction & "<br>" _ | ||
& | & "Size: " & adoCommand.Parameters(0).Size | ||
Set adoCommand = Nothing | Set adoCommand = Nothing |
Latest revision as of 13:52, 21 July 2020
Article ID: 253627
Article Last Modified on 6/12/2001
APPLIES TO
- Microsoft Visual InterDev 6.0 Standard Edition
- Microsoft ActiveX Data Objects 2.0
- Microsoft ActiveX Data Objects 2.01
- Microsoft ActiveX Data Objects 2.1
- Microsoft ActiveX Data Objects 2.1 Service Pack 1
- Microsoft ActiveX Data Objects 2.1 Service Pack 2
- Microsoft ActiveX Data Objects 2.5
- Microsoft ActiveX Data Objects 2.6
This article was previously published under Q253627
SYMPTOMS
When you use the Adodb.Command.Parameters.Refresh method with an Access stored query, the following error message appears:
CAUSE
ADODB does not support the Command.Refresh method for calling Access queries.
RESOLUTION
To work around this problem, use ActiveX Data Objects Extensions for Data Definition Language and Security (ADOX) with Catalog.Command. This will enable you to use Command.Refresh.
MORE INFORMATION
Paste the following code in a text editor, such as Microsoft Notepad, and save it as an ASP file in the \InetPub\WwwRoot folder. You can then execute this code from the browser to test the Catalog.Command.Refresh method.
NOTE: The code as provided here demonstrates the error. Refer to the comments in the code to avoid the error.
<HTML> <BODY> <%@ Language=VBScript %> <!-- #INCLUDE VIRTUAL="/ADOVBS.INC" --> <% Dim adoConnection Dim adoCommand Dim adoCatalog Dim strSQLCreateProc Dim strSQLDropProc 'JetOLEDB4.0 adoConnectString="Provider=Microsoft.JET.OLEDB.4.0;" & _ "Data Source=D:\inetPub\wwwRoot\Databases\Northwind.mdb;" & _ "User ID=Admin;Password=;" Set adoConnection = CreateObject("adodb.connection") With adoConnection .CursorLocation = adUseClient .Open adoConnectString End With strSQLCreateProc = "Create Procedure uspInsertShipper(" & _ "@parm1 VarChar(40)," & _ "@parm2 VarChar(24))" & _ "as " & _ "INSERT INTO Shippers (CompanyName, Phone)" & _ "VALUES(@parm1, @parm2)" strSQLDropProc = "Drop Procedure uspInsertShipper" On Error Resume Next adoConnection.Execute (strSQLDropProc) On Error GoTo 0 adoConnection.Execute (strSQLCreateProc) '* Comment this code (And uncomment the AdoX code below) to fix the error. Set adoCommand = CreateObject("adodb.command") Set adoCommand.ActiveConnection = adoConnection adoCommand.CommandText = "uspInsertShipper" adoCommand.CommandType = adCmdStoredProc adoCommand.Parameters.Append adoCommand.CreateParameter("parm1", adVarWChar, adParamInput, 40) adoCommand.Parameters.Append adoCommand.CreateParameter("parm2", adVarWChar, adParamInput, 24) adoCommand.Parameters.Refresh '* Uncomment this code (And comment the AdoDb code above) to fix the error. 'Set adoCatalog = CreateObject("adox.catalog") 'Set adoCatalog.ActiveConnection = adoConnection 'Set adoCommand = adoCatalog.Procedures("uspInsertShipper").Command 'adoCommand.Parameters.Append adoCommand.CreateParameter("parm1", adVarWChar, adParamInput, 40) 'adoCommand.Parameters.Append adoCommand.CreateParameter("parm2", adVarWChar, adParamInput, 24) 'adoCommand.Parameters.Refresh Response.Write "The parameter properties for uspInsertShipper: " & "<br>" _ & "Name: " & adoCommand.Parameters(0).Name & "<br>" _ & "Type: " & adoCommand.Parameters(0).Type & "<br>" _ & "Direction: " & adoCommand.Parameters(0).Direction & "<br>" _ & "Size: " & adoCommand.Parameters(0).Size Set adoCommand = Nothing Set adoConnection = Nothing Set adoCatalog = Nothing %> </HTML> </BODY>
Additional query words: error 0x800A0CC1
Keywords: kbprb KB253627