mibuso.com

Microsoft Business Solutions online community
It is currently Fri Apr 18, 2014 5:10 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: [Solved] VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu Apr 19, 2012 4:59 pm 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
Hi.

How can I set a date field to "empty" using VB.NET and Nav web services?

My code:

Code: Select all
Dim a As New NAV.Job_Service
a.UseDefaultCredentials = True
Dim b As NAV.Job
b = a.Read("a-job-no")
b.some_date_field = [color=#FF0000]???[/color]
a.Update(b)


Tried with Nothing/null, system.dbnull, date.minvalue, "1753-01-01"... but nothing seems to work.

Thanks.


--------------------------------------


Solution.

Luc Van Dyck wrote:
Vjeko has written a blog posting about the 0D bug: http://navigateintosuccess.com/blog/bug ... services-2


Hotfix, as seen in blog's comments.

Quote:
Soren January 12, 2012 at 23:19
KB2606541 – https://mbs2.microsoft.com/Knowledgebas ... us$2606541
Seems like this should be the fix for it. But i have not tested it.


I tested it and works. Now SqlDateTime.MinValue is the "null" date for Nav.


Last edited by dpardom on Thu May 03, 2012 9:45 am, edited 7 times in total.

Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu Apr 19, 2012 5:37 pm 
Offline

Joined: Thu Jan 29, 2009 5:06 pm
Posts: 365
Location: Sofia
Country: Bulgaria (bg)
the 0D value in NAV is '1753-01-01 00:00:00:000'. In .NET the functions expect DateTime variable.

_________________
-Mihail- [MCTS]


Top
 Profile E-mail  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu Apr 26, 2012 12:09 pm 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
Sorry, I don't understand very well what do you mean.

In .NET, it expects a "Date" variable.

With cdate("01/01/1753") it throws: "The * table contains a field with a date value that cannot be used with SQL Server".

\:D/


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu Apr 26, 2012 1:01 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5347
Location: Prague
Country: Czech Republic (cz)
dpardom wrote:
Sorry, I don't understand very well what do you mean.

In .NET, it expects a "Date" variable.

With cdate("01/01/1753") it throws: "The * table contains a field with a date value that cannot be used with SQL Server".

\:D/


Did you even read mihail's post. He gave you the exact answer. ](*,)

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu Apr 26, 2012 1:38 pm 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
I read it again, but can't understand.

Also, as I said, .NET function expects a "Date", not a "Datetime".

Can you explain it, please?


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Fri Apr 27, 2012 12:45 pm 
Offline

Joined: Thu Jan 29, 2009 5:06 pm
Posts: 365
Location: Sofia
Country: Bulgaria (bg)
No, you might wrote a method which expects Date variable. If you publish a function from NAV the Date parameter is represented as DateTime in .NET

_________________
-Mihail- [MCTS]


Top
 Profile E-mail  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Sat Apr 28, 2012 10:05 pm 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
Thanks for helping, mihail.

mihail_kolev wrote:
No, you might wrote a method which expects Date variable.


I published a function in a codeunit with a "date" parameter and a "datetime" parameter. Both are the same from .NET (both are "date" .NET type), and can't use sqldatetime.minvalue (wich seems to be the "null" value for Nav) with none ot them.

The problem seems to be that '1753-01-01 00:00:00:000' is not converted to '0D'. Maybe a regionalization problem? We got other problems related with dates and decimals due to diferences in representation.

mihail_kolev wrote:
If you publish a function from NAV the Date parameter is represented as DateTime in .NET


I don't understand how to modify a date through a Nav web services without publishing a function. (ie, a page with its "modify" function or a function in a codeunit)


Please, check the workaround I added to the first post. Maybe it helps.

Thanks again.


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Sat Apr 28, 2012 11:31 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3453
Location: Wilrijk
Country: Belgium (be)
Vjeko has written a blog posting about the 0D bug: http://navigateintosuccess.com/blog/bug ... services-2

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2014 - 20 & 21 November 2014 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu May 03, 2012 9:41 am 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
Thank you very much, Luc Van Dyck. That was the problem. I copied the answer to the first post.

Thank you too, mihail_kolev, for trying to help.

And for David Singleton an (optional) advice: Don't give such answers, even if you are right.

See you.


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Thu May 03, 2012 4:57 pm 
Offline

Joined: Tue Jun 21, 2011 1:39 pm
Posts: 521
Country: Netherlands (nl)
dpardom wrote:
Hotfix, as seen in blog's comments.

Quote:
Soren January 12, 2012 at 23:19
KB2606541 – https://mbs2.microsoft.com/Knowledgebas ... us$2606541
Seems like this should be the fix for it. But i have not tested it.


I tested it and works. Now SqlDateTime.MinValue is the "null" date for Nav.


Hi,
1.
Has this hotfix been retracted?? if i click on download I cannot select the hotfix.

2.
Is this the latest hotfix or can I use a newer one to fix all problems?


Top
 Profile E-mail  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Tue May 08, 2012 8:29 am 
Offline

Joined: Tue Oct 31, 2006 9:55 am
Posts: 56
Location: SPAIN
1.- You must login with one of the four methods listed in the page. Then click "View and request hotfix downloads", and provide an email address to receive the hotfix link.

2.- Sorry, I don't know.


Top
 Profile  
 
 Post subject: Re: VB.NET + NAV Web service: Set date to "empty"
PostPosted: Tue May 08, 2012 10:11 am 
Offline

Joined: Tue Jun 21, 2011 1:39 pm
Posts: 521
Country: Netherlands (nl)
dpardom wrote:
1.- You must login with one of the four methods listed in the page. Then click "View and request hotfix downloads", and provide an email address to receive the hotfix link.

2.- Sorry, I don't know.

Yes, that is correct, but on the page after "View and request hotfix downloads" I can type in my emailaddress but there is no hotfix to select. Could anyone check this?


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: