sql date converted to infopath date - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

sql date converted to infopath date

Last post 03-22-2011 12:42 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-21-2011 12:52 PM

    sql date converted to infopath date

     hi all,

     

    I'm having some difficulties converting a sql date back to a date that infopath can use. The date in Sql server is 2011-03-01 00:00:00:000

    I'm trying to convert this to DateTime back into an infopath datepicker field but it's giving me an error of "Schema validation found non-data type errors."

    my code is this:

    nav.SelectSingleNode("/my:myFields/my:sLayout/my:dpExpirationDate", NamespaceManager).SetValue(Convert.ToDateTime(reader("ExpirationDate")))

    I want the date stored in sql server to be populated in my infopath form in a datepicker field.

     

    My research found that this error can be caused if the value is nil in the database, however, there is clearly a date and time in the sql field.

    I've tried converting the data using CDate, etc without success.  Can someone point me in the right direction?

     

    thanks

     

  • 03-22-2011 12:42 AM In reply to

    Re: sql date converted to infopath date

    I think you've misunderstood your reasearch.  The issue is most likely that the node you're trying to modify has an xsi:nil attribute that has to be removed before you set its value.  If you search this forum for xsi:nil, you should find examples of how to to this.

    In order to put the date in the right format, you need to convert the DateTime to an ISO string with .ToString("s")

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.