By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

SQL Bulk Load

P: n/a
Hi

I am new to working with XML and am trying Bulk load data into MS SQL
2000 using VB.net on Visual Studio 2003.
I add a ref to XBLKld4.ll

The example code seems to be fairly easy to follow.

Dim h As New SQLXMLBULKLOADLib.SQLXMLBulkLoad

With h
.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Initial Catalog=pubs;Data Source=03765AIRPS"
.ErrorLogFile = "c:\LocatorPlusImport.errlog"
.KeepIdentity = False

.BulkLoad = True

.SchemaGen = True

.Execute("c:\123.xsd", "c:\123.xml")
End With

When the code runs nothing appears to happen, however when I do an SQL
trace I see the sql Below runs
exec [pubs]..sp_foreign_keys_rowset;2 N'ITEMS', NULL, NULL, NULL,
N'pubs'

But I still end up with No data?

Can anyone help ?
Many Thanks

Example of 123.XML
<ITEMS xmlns="http://tempuri.org/123.xsd">
<ITEM TRADE="Carpentry and Joinery" HEADING="Kitchen Units"
SUBJECT="Worktops" FILTER="0"
VER="NHF4">
<CODE>372001</CODE>
<PRIORITY>3</PRIORITY>
<JOBTITLE>WORKTOP:32MM TH - POST FORMED.</JOBTITLE>
<DESCRIPTION>Worktop:Renew with w/proof chipboard worktop ne 32mm th.
with 1.3mm laminate veneer, reverse compensated, post formed one edge,
veneer exposed edges, seal wall joint and make good wall
tiling.</DESCRIPTION>
<UNIT>LM</UNIT>
<RATE>35.93</RATE>
<QUANTITY>2</QUANTITY>
<COMMENT></COMMENT>
<UID>0</UID>
</ITEM>
<ITEM TRADE="Plumbing" HEADING="Appliances" SUBJECT="Sealant Joints to
Sanitary Appliances &amp; Fittings"
FILTER="0" VER="NHF4">
<CODE>631505</CODE>
<PRIORITY>3</PRIORITY>
<JOBTITLE>SEALANT:RENEW TO BASIN/SINK.</JOBTITLE>
<DESCRIPTION>Sealant:Renew sanitaryware silicone sealant to sides of
basin or sink.</DESCRIPTION>
<UNIT>IT</UNIT>
<RATE>4.58</RATE>
<QUANTITY>1</QUANTITY>
<COMMENT></COMMENT>
<UID>1</UID>
</ITEM>
</ITEMS>
Example of 123.xsd

<?xml version="1.0"?>
<xs:schema id="ITEMS" targetNamespace="http://tempuri.org/123.xsd"
xmlns:mstns="http://tempuri.org/123.xsd"
xmlns="http://tempuri.org/123.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="ITEMS" msdata:IsDataSet="true"
msdata:Locale="en-GB" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ITEM">
<xs:complexType>
<xs:sequence>
<xs:element name="CODE" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
<xs:element name="PRIORITY"
type="xs:string" minOccurs="0" msdata:Ordinal="1" />
<xs:element name="JOBTITLE"
type="xs:string" minOccurs="0" msdata:Ordinal="2" />
<xs:element name="DESCRIPTION"
type="xs:string" minOccurs="0" msdata:Ordinal="3" />
<xs:element name="UNIT" type="xs:string"
minOccurs="0" msdata:Ordinal="4" />
<xs:element name="RATE" type="xs:string"
minOccurs="0" msdata:Ordinal="5" />
<xs:element name="QUANTITY"
type="xs:string" minOccurs="0" msdata:Ordinal="6" />
<xs:element name="COMMENT" type="xs:string"
minOccurs="0" msdata:Ordinal="7" />
<xs:element name="UID" type="xs:string"
minOccurs="0" msdata:Ordinal="8" />
</xs:sequence>
<xs:attribute name="TRADE" form="unqualified"
type="xs:string" />
<xs:attribute name="HEADING" form="unqualified"
type="xs:string" />
<xs:attribute name="SUBJECT" form="unqualified"
type="xs:string" />
<xs:attribute name="FILTER" form="unqualified"
type="xs:string" />
<xs:attribute name="VER" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.