PRB: Error 3251 Generated by Calling ADOX Methods
ID: Q201716
|
The information in this article applies to:
-
ActiveX Data Objects (ADO), version 2.1
SYMPTOMS
Executing an ADOX method such as the following:
Catalog.Tables.Append tbl
against SQL Server may generate the following error:
Run time error "3251":
"The operation requested by the application is not supported by the provider".
CAUSE
SQL Server's Stored Procedures are not current.
RESOLUTION
Run the Instcat.sql script that came with the version of Microsoft Data Access Components (MDAC) currently installed.
STATUS
This behavior is by design.
MORE INFORMATION
The Connection's Errors collection should also reveal an error like the following:
[Microsoft][ODBC SQL Server Driver][SQL Server]The ODBC catalog stored procedures installed on server (local) are version 6.50.193; version 07.00.0523 or later is required to ensure proper operation. Please contact your system administrator.
The catalog stored procedures installed on server <Server_Name> are version 6.50.193; version 07.00.0330 or later is required to support IDBSchemaRowset. Please contact your system administrator.
Steps to Reproduce Behavior
- Start Visual Basic.
- Choose a Standard EXE Project Type.
- Add the following References to the Project:
Microsoft ActiveX Data Objects
Microsoft Ext. for DDL and Security
- Paste the following code in the Load method of the default Form:
Dim tbl As New ADOX.Table
Dim cn As New ADODB.Connection
Dim cl As New ADOX.Column
Dim cat As New ADOX.Catalog
'Open Connection to Data Source
With cn
.ConnectionString = "PROVIDER=sqloledb;DATA SOURCE=<your_server;USER ID=<uid>;PASSWORD=<pwd>;INITIAL CATALOG=pubs"
.Open
End With
'Associate the Catalog object to the Connection.
With cat
.ActiveConnection = cn
End With
'Create a table definition.
With tbl
.Name = "MyADOXtbl"
End With
'Create a Column definition.
With cl
.Name = "Col1"
.DefinedSize = 10
.Type = adChar
.Attributes = adColFixed + adColNullable
End With
'Add the Column definition to the table table definition.
tbl.Columns.Append cl
'Create the table on the Data Source
cat.Tables.Append tbl
Additional query words:
kbDSupport
Keywords : kbADO210 kbDatabase kbSQLServ kbGrpVBDB kbGrpMDAC
Version : WINDOWS:2.1
Platform : WINDOWS
Issue type : kbprb