INFO: Optional Feature Not ImplementedID: Q214459
|
When using ActiveX Data Objects (ADO) to pass parameters to a stored procedure, you may get the following error:
Optional Feature Not Implemented.
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
Private Sub MySubroutine()
Dim dbConnection As ADODB.Connection
Dim dbCommand As ADODB.Command
Set dbConnection = New ADODB.Connection
Set dbCommand = New ADODB.Command
Dim DSNNAME As String
Dim USERNAME As String
Dim PASSWORD As String
DSNNAME = "Pubs"
USERNAME = "sa"
PASSWORD = ""
dbConnection.Open DSNNAME, USERNAME, PASSWORD
dbCommand.ActiveConnection = dbConnection
Dim TheDate As Date
TheDate = Now
dbCommand.CommandText = "GetEmployeeInfo"
dbCommand.CommandType = adCmdStoredProc
dbCommand.Parameters.Append dbCommand.CreateParameter("@thedate", adDBDate, adParamInput, 0, TheDate)
dbCommand.Parameters.Append dbCommand.CreateParameter("@NumEmployees", adInteger, adParamOutput, 0)
dbCommand.Execute
Dim strTheString As String
strTheString = "There are " & dbCommand.Parameters("@numemployees") & " employees who were hired before " & TheDate
MsgBox strTheString, vbOKOnly, "Demonstration"
End Sub
When the sample code is run, it gives this error:
This is because SQL Server does not support the adDBDate datatype. To correct this problem, change the datatype of the @theDate parameter to adDBTimeStamp.Optional feature not Implemented.
Additional query words: SQL Server ADO ActiveX Data Objects ODBC Database
Keywords : kbADO200
Version : WINDOWS:2.0
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: April 20, 1999