You are currently offline, waiting for your internet to reconnect

INFO: "Optional Feature Not Implemented" Error Message

This article was previously published under Q214459
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
SUMMARY
When you use ActiveX Data Objects (ADO) to pass parameters to a stored procedure, you may receive the following error:
Run-time error '2147217887 (80040e21)':
[Microsoft][ODBC SQL Server Driver] Optional Feature Not Implemented.
MORE INFORMATION
This error can occur if you attempt to set the TYPE of a parameter in an ADODB command object's parameters collection to a type that is not supported by the data provider.

For example, using SQL Server 7.0, create a stored procedure on the PUBS database:
   CREATE PROCEDURE GetEmployeeInfo (@thedate datetime, @NumEmployees int output)AS        SELECT @NumEmployees =  count(*) FROM EMPLOYEE WHERE hire_date < @thedate   GO				
This stored procedure returns an output parameter of type int indicating the number of employees hired before a given date. The date is passed to the stored procedure as a parameter, and the number of employees is passed to the calling program as an output parameter.

Now create an ADO application to use the stored procedure. The example given is written in Visual Basic.
Private Sub MySubroutine()Dim dbConnection As ADODB.ConnectionDim dbCommand As ADODB.CommandSet dbConnection = New ADODB.ConnectionSet dbCommand = New ADODB.CommandDim DSNNAME As StringDim USERNAME As StringDim PASSWORD As StringDSNNAME = "Pubs"USERNAME = "sa"PASSWORD = ""dbConnection.Open DSNNAME, USERNAME, PASSWORDdbCommand.ActiveConnection = dbConnectionDim TheDate As DateTheDate = NowdbCommand.CommandText = "GetEmployeeInfo"dbCommand.CommandType = adCmdStoredProcdbCommand.Parameters.Append dbCommand.CreateParameter("@thedate", adDBDate, adParamInput, 0, TheDate)dbCommand.Parameters.Append dbCommand.CreateParameter("@NumEmployees", adInteger, adParamOutput, 0)dbCommand.ExecuteDim strTheString As StringstrTheString = "There are " & dbCommand.Parameters("@numemployees") & " employees who were hired before " & TheDateMsgBox strTheString, vbOKOnly, "Demonstration"End Sub				
When the sample code is run, it gives this error:
Run-time error '2147217887 (80040e21)':
[Microsoft][ODBC SQL Server Driver] Optional feature not Implemented.
This is because SQL Server does not support the adDBDate datatype. To correct this problem, change the datatype of the @theDate parameter to adDBTimeStamp.

In order to determine the number, names, types, and sizes of parameters needed in a stored procedure, use the Parameters.Refresh method of the command object. You can call this method during development of your application to determine the correct requirements for the stored procedure, then remove the expensive call to Parameters.Refresh after you have gathered the necessary data.
database
Properties

Article ID: 214459 - Last Review: 08/23/2001 09:52:00 - Revision: 1.0

  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft ActiveX Data Objects 2.7
  • kbinfo kbstoredproc KB214459
Feedback