web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Failed to convert parameter value from a String to a DateTime.

(0) ShareShare
ReportReport
Posted on by

Hi... All

i am  trying to create xml file using edi file, am using econnect inferace in MS Dynamic GP,

through my code i creted xml file but wen the control goes to this line 

 string custid = eConcall.CreateTransactionEntity(connStr, custdocument);

It is giving error like :

Microsoft.Dynamics.GP.eConnect.eConnectException: Failed to convert parameter va

lue from a String to a DateTime.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    John Lowther Profile Picture
    5,122 on at

    First I will admit that I do not use eConnect, however, I do import several MySQL database tables to MSSQL databases for data warehousing. And in that process I see this error quite a lot. It is just about always caused when a string that is supposed to be a date is not actually a valid date. For example 09/31/2011 is not a valid date as September does not have 31 days and when trying to import this into MSSQL this is the error I get.

    With all that said, try looking through your XML file specifically at the fields that are supposed to be Dates.  My bet is that one of them is either empty and thus should be 01/01/1900 or one of them is not a valid date.

    Hope this helps,

  • Community Member Profile Picture
    on at

    Did got a solution?

    I have the same issue here :(... 

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,093 Most Valuable Professional on at

    I would suggest having a look at this post I wrote.

    blogs.msdn.microsoft.com/.../quick-tip-passing-date-and-time-variables-to-sql-server

    It also mentions an issue when the Time suffixes have been changed from AM and PM to A.M. and P.M.  SQL Server cannot handle the suffixes with the dots/periods. Check your regional settings.

    David

  • Community Member Profile Picture
    on at

    But how can i use this with econnect. its reading date from the xml document.

    I am trying to run the econnect sample for salesorder entry.

    the date format in regional settings is MM-dd-yyyy.

    and in the XML file also it is the same.

    Also get the same error when i run the 'Directdocumentsenderdotnet' sample from the econnect. Here i am directly using an xml document. i tried changing to many date formats in the xml failed.

    "Microsoft.Dynamics.GP.eConnect.eConnectException: Failed to convert parameter value from a String to a DateTime."

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,093 Most Valuable Professional on at

    Please check your Time regional settings.

    Are you using 24 hour or 12 hour time?

    If using 12 hour time, what are the suffixes you are using for morning and afternoon. Only am, pm, AM, PM are supported by SQL.

    David

  • Suggested answer
    John Lowther Profile Picture
    5,122 on at

    Hey Fazil,

    I do believe that David is on the right track, and that the problem is the different ways that the date can be formatted depending on various settings; however, in my humble opinion, I would try using an explicit conversion using the SQL Convert function on the field in the eConnect "Pre" procedure.
    It is also possible that you may even need to convert the field from the starting string to a DateTime,  and then back to a string to end up with it in the correct regional settings format.
    Yes, that's a double convert, but I have run into some places where that was the only way to get it to work and if it works, it works. :)

    You can find lots of information on the various parameters of the Convert function on this MSDN page.

    Hope this gets you headed in the right direction, and let me know how it goes.

  • Peter Muchira Profile Picture
    1,912 on at

    Hello Fazil,

    Also ensure that profile of the econnect service account has a date format that is consistent with the one your are using in the XML. Econnect seems to 'prefer' the MM-dd-yyyy. So just login to the profile of the service account (under which econnect services are running) and confirm the date format under Calendar settings.

  • Suggested answer
    Community Member Profile Picture
    on at

    Thats it. Setting up econnect service account solved the problem. Thanks a TONN dear.

  • Peter Muchira Profile Picture
    1,912 on at

    Hello Fazil,

    You are welcome. Kindly mark it as an answer, to assist others who may search for the same issue.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
mtabor Profile Picture

mtabor 1

#2
Victoria Yudin Profile Picture

Victoria Yudin 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=%2F.++6" - Nested quantifier +.