Submitting a date field to SQL (via a procedure) with IP 2003 and JScript - InfoPath Dev
in

InfoPath Dev

Submitting a date field to SQL (via a procedure) with IP 2003 and JScript

Last post 10-03-2008 10:20 AM by jaden403. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-02-2008 02:45 PM

    Submitting a date field to SQL (via a procedure) with IP 2003 and JScript

    In my form I am trying to pass a date to a stored procedure.  However, everytime I submit I get an error because of the formatting of the date: 2008-10-2T15:53:51.  I have tried using the toDate() method, but the form always throws an error about how the method is not supported.  So my question is how do you pass a date to SQL in InfoPath and JScript?   

    I am currently writing to SQL using a variable and passing it to my ADO connection. 

    var date =  "procName " + parameters to pass, etc;

    The above works in all cases except when trying to pass a date as a parameter. 

    What is the best way around this?

    Thanks.

  • 10-03-2008 02:17 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Submitting a date field to SQL (via a procedure) with IP 2003 and JScript

    Hello,

    Passing the Data parameter format should be same as SQL Data type format. SQL Date data type format should be equal to ‘MM/DD/YYYY HH:MM:SS AM'. If we pass different format then it will gives the error.

    For this you have convert into ToString() format of Date format then you will get SQL date data type format. [toDate().ToString()]

  • 10-03-2008 10:20 AM In reply to

    Re: Submitting a date field to SQL (via a procedure) with IP 2003 and JScript

    Thanks for the response, but SQL still won't accept the parameter.  I keep getting the same error:

    "Object doesn't support this property or method". 

    What I am doing is this:

     var date = XDocument.DOM.selectSingleNode("//my:dateTimeStamp").text;

    Then I pass it as a parameter.  But date.toDateString() gives the error above.  What am I doing wrong here? 

     

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.