Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem:datetime&logical data expression in XML
Message
From
21/01/2005 01:47:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Title:
Problem:datetime&logical data expression in XML
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00979190
Message ID:
00979190
Views:
54
Hi,
When I pass a XML string generated by vfp9 function cursortoxml() to a SQL SERVER 2000 stored procedure for parsing with openxml(),encountered a problem that Datetime data & Logic data is not able to be parsed into related rowset columns defined with colpattern patameters by respective Datetime and Bit field-type.Via checking the XML string at side of VFP,found a 'T' was inserted between the Date portion and time portion of datetime-type data i.e.
"2000-10-03 02:02:02"->"2000-10-03T02:02:02",and .t.,.f. were converted into "true","false".

Any ideas? The sample codes below are FYI:

VFP9:-
       create cursor  tmp ( f1 t, f2 L)
       INSERT INTO  tmp values(DATETIME(),.t.)
       INSERT INTO  tmp values(DATETIME(),.f.)
       select tmp
       BROWSE
       ?CURSORTOXML("tmp","cxml",1,0,0)
       ?cxml
       ?SQLEXEC(_screen.sqlhnd,"exec ReadXml ?cxml",'sql_cur') && set your own SQL handle
       select sql_cur
       BROWSE
SQL SP:-
    CREATE PROCEDURE  ReadXML 
    (
     @xml  text
     )
    as
    declare @xdoc int
    exec sp_xml_preparedocument @xdoc output, @xml 
    select a.*   from openxml (@xdoc, '/VFPData/tmp', 2) with (f1 datetime,f2  bit) as a
    exec sp_xml_removedocument @xdoc
    GO   
However,if
... with (f1 datetime,f2  bit) ...
is rewrited as
... with (f1 varchar(20),f2 varchar(10)) ...
the procedure can perform with no problem.

HTH
Steven
Next
Reply
Map
View

Click here to load this message in the networking platform