Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Unanswered: using parameterized call to add datetime

    Using classic ASP...
    I'm trying to get a date into SQL Server using parameterized call to a stored procedure.

    this line is being flagged up as causing an error.
    ADODB.Parameters error '800a0e7c'

    Parameter object is improperly defined. Inconsistent or incomplete information was provided.
    Code:
    com.parameters.append (com.CreateParameter("@submitDate", DATETIME, adParamInput, 8, now()))
    The DB is set to datetime and won't let me change the number of chars, so I think I have set the call to ask for the same thing. (goodness knows!)

    So, can anyone see anything obviously wrong with this bit? The other lines are similarly formatted but just add varchars and seem OK.

  2. #2
    Join Date
    Sep 2011
    Posts
    71
    Hello Darkmunk ,

    I guess some thing ,if you use sql2005,you should use type Date instead of DateTime.

    Try and reply me

  3. #3
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102
    Thanks paultech,
    my email didn't inform me of your post, sorry.

    I started with DATE but it gives the same error. Also, I don't know how to format the parameter code in ASP, as 'data' is a reserved word.

  4. #4
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Thumbs up Fixed

    I had my columns in the wrong order!
    Parameterized calls (parameters.append) need to be in the correct order for the DB columns, it's not just like giving values to variables.
    I also had the datetime bit wrong and didn't need a size value.
    so:
    Code:
    com.parameters.append (com.CreateParameter("@submitDate", adDBTimeStamp, adParamInput, , now()))
    stored proc:
    Code:
    @submitDate dateTime,
    and the DB data type is 'dateTime'.
    Feel free to chip in with improvements, but this works

Posting Permissions

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