Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing DateTime parameters to sprocs

Status
Not open for further replies.

wbodger

Programmer
Apr 23, 2007
769
US
So, I have this code:
Code:
Dim cmd
SET cmd = server.CreateObject("ADODB.Command")
with cmd
	.ActiveConnection = conn
	.CommandText = "ycmhome.sp_addevent"
	.CommandType = adCmdStoredProc

	' Input parameters
    .Parameters.Append .createparameter("@ministry_id", adInteger, adParamInput, , ministry_id)
    .Parameters.Append .createparameter("@event_order", adInteger, adParamInput, , event_order)
    .Parameters.Append .createparameter("@event_Status", adTinyInt, adParamInput, , event_Status)
    .Parameters.Append .createparameter("@event", adVarChar, adParamInput, 50, eventname)
    .Parameters.Append .createparameter("@sub_event", adVarChar, adParamInput, 50, sub_event)
    .Parameters.Append .createparameter("@event_date", adVarChar, adParamInput, 50, event_date)
    .Parameters.Append .createparameter("@cost", adVarChar, adParamInput, 10, cost)
    .Parameters.Append .createparameter("@deposit_cost", adVarChar, adParamInput, 10, deposit_cost)
    .Parameters.Append .createparameter("@group_cost", adVarChar, adParamInput, 10, group_cost)
    .Parameters.Append .createparameter("@group_deposit_cost", adVarChar, adParamInput, 10, group_deposit_cost)
    .Parameters.Append .createparameter("@space_available", adInteger, adParamInput, , space_available)
    .Parameters.Append .createparameter("@pricing_id", adInteger, adParamInput, , pricing_id)
    .Parameters.Append .createparameter("@min_group", adInteger, adParamInput, , min_group)
    .Parameters.Append .createparameter("@max_group", adInteger, adParamInput, , max_group)
    .Parameters.Append .createparameter("@survey", adTinyInt, adParamInput, , survey)
    .Parameters.Append .createparameter("@event_year", adVarChar, adParamInput, 4, event_year)
    .Parameters.Append .createparameter("@start_date", adDate, adParamInput, , start_date)

    'Execute the function
	.Execute, , adExecuteNoRecords
        
end with

And I seem to have an issue with the final parameter, @start_date. I get the error:

Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

[Microsoft][ODBC SQL Server Driver]Optional feature not implemented

But I need that value passed in as a date so I can use it as a date for restricting future queries. I include adovbs.inc adn every other sproc I use works fine (but I have none that pass dates to the server). Am I using an old outdated adovbs.inc file? Am I misusing the datatype somehow? In SQL Server it is a datetime type. If it matters, I am running against a SQL 2k database.

Thanks,
Willie
 
Dates are awkward. Try converting the date to a string before passing it across
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top