InfoPath mangling datetimes returned from SQL Server through web service

H

Howard Swope

If I format my date to show as xml the date I set and send to the database
is correct. When I requery I get the correct data back. However, if I format
my date to anything else it drops it back five hours. It is an interesting
coincidence that I am on the eastern standard time -5:00.

I have seen different messages saying that xml serialization is mangling the
date, but when I look at it as XML it looks correct.

What is going on?
 
H

Howard Swope

It looks like the web service xml serialization of the datetime datatype
adds a time zone indication on to its text representation. Info path doesn't
interpret this properly. If you handle the OnAfterChange event for each
datetime field and strip off the timezone, InfoPath does the right thing.

public void startDate_OnAfterChange(DataDOMEvent e)

{

// Write your code here. Warning: ensure that the
constraint you are enforcing is

// compatible with the default value you set for this XML
node.



if (e.Site.text.Length == 33)

e.Site.text = e.Site.text.Substring(0,19);

}
 
Top