Problems with passing Date Parameters to Stored Pr

Results 1 to 2 of 2

Thread: Problems with passing Date Parameters to Stored Pr

  1. #1
    Join Date
    Dec 1969

    Default Problems with passing Date Parameters to Stored Pr

    AM using a stored procedure to perform some next functionality, The date is taken from an ASP page via a Request.QueryString.<BR><BR>The Stored Procedure is expecting an input of type DateTime but when I send the parameter in via an execute statment I get the error "[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near &#039/&#039."<BR><BR>I have tried various methods of converting date even passing the date in as a string and converting it with an SQL Convert Statement.<BR><BR>Anyone with some experience of passing Dates out there with a top tip.<BR><BR>Thanks<BR><BR>

  2. #2
    Garth Guest

    Default RE: Problems with passing Date Parameters to Store

    The code below works<BR><BR><BR>Garth<BR><BR><BR>< BR>--*Table Structure<BR>CREATE TABLE DateTest<BR>(<BR> f1 datetime<BR>)<BR><BR><BR>--*Stored Procedure<BR>CREATE PROCEDURE ps_DateTest<BR>@f1 datetime<BR>AS<BR>INSERT DateTest VALUES (@f1)<BR><BR><BR>--*ASP<BR>&#060;!--#include file=""--&#062;<BR>&#060;%<BR> xDate = "&#03901/01/90&#039"<BR> sSQL = "ps_DateTest " & xDate<BR> rs = SQLConn.Execute(sSQL)<BR>%&#062;<BR><BR><BR>Obviou sly you have to substitute your connection information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts