Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLXMLBulkLoad
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01380551
Message ID:
01380566
Views:
45
>Don't know if related, but there is a thread here on the topic
>SQLXMLBulkLoad and empty memo fields Thread #1380476
>>Hi All,
>>i am trying to test of Dough Hennig's SQLXMLBulkLoad sample , its working no error but records not appear on SQL Server
>>where is the problem ?
>>
>>TIA
>>
>>
>>PS : 1-SAOP toolkit version 3 allready installed
>> 2-cursor CrsTest allready open
>> 3- database and table allready exist on SQL Server
>>
>>
>>SET SAFETY off
>>CREATE CURSOR crsTest(ad c(20),soyad c(50))
>>INSERT INTO crsTest values('soykan','ozcelik')
>>INSERT INTO crsTest values('dh ozcelik','ozcelik')
>>
>>SELECT crsTest
>>xml_copy2_sql('CrsTest','test','xml_test','.\SQLEXPRESS')
>>
>>*==============================================================================
>>* Function:        BulkXMLLoad
>>* Purpose:         Performs a SQL Server bulk XML load
>>* Author:          Doug Hennig
>>* Last revision:   07/06/2006
>>* Parameters:      tcAlias    - the alias of the cursor to export
>>*                  tcTable    - the name of the table to import into
>>*                  tcDatabase - the database the table belongs to
>>*                  tcServer   - the SQL Server name
>>*                  tcUserName - the user name for the connection (optional:
>>*                    if it isn't specified, Windows Integrated Security is
>>*                    used)
>>*                  tcPassword - the password for the connection (optional:
>>*                    if it isn't specified, Windows Integrated Security is
>>*                    used)
>>* Returns:         an empty string if the bulk load succeeded or the text of
>>*                    an error message if it failed
>>* Environment in:  the alias specified in tcAlias must be open
>>*                  the specified table and database must exist
>>*                  the specified server must be accessible
>>*                  there must be enough disk space for the XML files
>>* Environment out: if an empty string is returned, the data was imported into
>>*                    the specified table
>>*==============================================================================
>>Function xml_copy2_sql
>>
>>	Lparameters tcAlias, ;
>>		tcTable, ;
>>		tcDatabase, ;
>>		tcServer, ;
>>		tcUserName, ;
>>		tcPassword
>>	Local lnSelect, ;
>>		lcSchema, ;
>>		lcData, ;
>>		lcReturn, ;
>>		loException As Exception, ;
>>		lcXSD, ;
>>		loBulkLoad
>>
>>
>>	* Create the XML data and schema files.
>>
>>
>>	lnSelect = Select()
>>	Select (tcAlias)
>>	lcSchema = Forceext(tcTable, 'xsd')
>>	lcData   = Forceext(tcTable, 'xml')
>>	Try
>>		Cursortoxml(Alias(), lcData, 1, 512 + 8, 0, lcSchema)
>>		lcReturn = ''
>>	Catch To loException
>>		lcReturn = loException.Message
>>	Endtry
>>
>>
>>	* Convert the XSD into a format acceptable by SQL Server. Add the SQL
>>	* namespace, convert the  start and end tags to ,
>>	* use the sql:datatype attribute for DateTime fields, and specify the table
>>	* imported into with the sql:relation attribute.
>>
>>
>>	If Empty(lcReturn)
>>		lcXSD = Filetostr(lcSchema)
>>		lcXSD = Strtran(lcXSD, ':xml-msdata">', ;
>>			':xml-msdata" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">')
>>		lcXSD = Strtran(lcXSD, 'IsDataSet="true">', ;
>>			'IsDataSet="true" sql:is-constant="1">')
>>		lcXSD = Strtran(lcXSD, '<xsd:choice maxOccurs="unbounded">', ;
>>			'<xsd:sequence>')
>>		lcXSD = Strtran(lcXSD, '</xsd:choice>', ;
>>			'</xsd:sequence>')
>>		lcXSD = Strtran(lcXSD, 'type="xsd:dateTime"', ;
>>			'type="xsd:dateTime" sql:datatype="dateTime"')
>>		lcXSD = Strtran(lcXSD, 'minOccurs="0"', ;
>>			'sql:relation="' + Lower(tcTable) + '" minOccurs="0"')
>>		Strtofile(lcXSD, lcSchema)
>>
>>
>>		* Instantiate the SQLXMLBulkLoad object, set its ConnectionString and other
>>		* properties, and call Execute to perform the bulk import.
>>
>>
>>		Try
>>			loBulkLoad = Createobject('SQLXMLBulkLoad.SQLXMLBulkload.4.0')
>>			lcConnString = 'Provider=SQLOLEDB.1;Initial Catalog=' + tcDatabase + ;
>>				';Data Source=' + tcServer + ';Persist Security Info=False;'
>>			If Empty(tcUserName)
>>				lcConnString = lcConnString + 'Integrated Security=SSPI'
>>			Else
>>				lcConnString = lcConnString + 'User ID=' + tcUserName + ;
>>					';Password=' + tcPassword
>>			Endif Empty(tcUserName)
>>			loBulkLoad.ConnectionString = lcConnString
>>			*** Can set the ErrorLogFile property to the name of a file to write import
>>			*** errors to
>>			loBulkLoad.KeepNulls        = .T.
>>			loBulkLoad.Execute(lcSchema, lcData)
>>			lcReturn = ''
>>		Catch To loException
>>			lcReturn = loException.Message
>>		Endtry
>>
>>
>>		* Clean up.
>>
>>
>>		Erase (lcSchema)
>>		Erase (lcData)
>>	Endif Empty(lcReturn)
>>	Select (lnSelect)
>>	Return lcReturn
>>
>>Endfunc
>>
>>
i've read the topics but there no answer for me also i've just 2 test records and also not from memo fields :(
Previous
Reply
Map
View

Click here to load this message in the networking platform