Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:17:28+00:00 2026-06-12T15:17:28+00:00

I’m trying to use SQLXMLBulkLoader4 from C# code into an SQL 2008 DB. But

  • 0

I’m trying to use SQLXMLBulkLoader4 from C# code into an SQL 2008 DB. But for some reason it doesn’t insert any rows at all despite not throwing any error. I’ve made use of the bulkloads own ErrorLog file, (to check for any errors that might not cause it to crash), but no error is reported.

I have a XML file that is downloaded from a supplier (basically a list of products), I wrote an XSD to match the fields to our DB. There is nothing else writing to those specific tables, and nothing else using those files.

My BulkLoad code looks as follows (I X’ed out the actual connection string values):

public void Bulkload(string schemaFile, string xmlFile, string source)
    {
        SQLXMLBULKLOADLib.SQLXMLBulkLoad4 bulkload = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4();

        try
        {
            bulkload.ConnectionString = "Provider=sqloledb;server=X;database=X;uid=X;pwd=X";
            bulkload.ErrorLogFile = k_ArticleInfoDirectory + source + "BulkLoadError.log";
            bulkload.KeepIdentity = false;
            bulkload.Execute(schemaFile, xmlFile);
        }
        catch (Exception e)
        {
            Console.WriteLine("Fel i BL: " + e);
            throw;
        }
        finally
        {
            bulkload = null;
        }

    }

The XML looks like this (stripped down, everything below is just a couple more product-fields and then more products):

<?xml version="1.0" encoding="utf-8"?>
<GetProductsResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Status xmlns="http://schemas.servicestack.net/types">
    <Code>0</Code>
    <Message>Ok</Message>
  </Status>
  <NumberOfProducts xmlns="http://schemas.servicestack.net/types">9826</NumberOfProducts>
  <Products xmlns="http://schemas.servicestack.net/types">
    <Product>
      <ProductID>1000002</ProductID>
      <CreatedDate>2011-11-24 15:54</CreatedDate>
      <UpdatedDate>2011-11-24 15:54</UpdatedDate>
      <Title>Vi tolererar inga förlorare - klanen Kennedy</Title>
      <Publisher>Piratförlaget</Publisher>
      ... And some more fields per Product

The XSD I wrote looks like this (again shortened):

<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema targetNamespace="http://schemas.servicestack.net/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">

<xs:annotation>
    <xs:appinfo>

        <sql:relationship name="Status"
        parent="tblElibProduct"
        parent-key="id"
        child="tblElibStatus"
        child-key="product_id" />
                    ... + Several other sql:relationships
            </xs:appinfo>
</xs:annotation>
    <xs:element name="GetProductsResult" sql:is-constant="1">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Status" sql:is-constant="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Code" type="xs:integer" minOccurs="0" />
                        <xs:element name="Message" type="xs:string" minOccurs="0" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="NumberOfProducts" type="xs:string" sql:is-constant="1"/>
            <xs:element name="Products" sql:is-constant="1">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" maxOccurs="unbounded" name="Product" sql:relation="tblElibProduct">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element minOccurs="1" maxOccurs="1" name="CreatedDate" type="xs:date" sql:field="created_date" />
                                    <xs:element minOccurs="1" maxOccurs="1" name="UpdatedDate" type="xs:date" sql:field="updated_date" />
                                    <xs:element minOccurs="1" maxOccurs="1" name="Title" type="xs:string" sql:field="title" />

I’ve stared myself blind at the namespaces, but they look correct to me. (Read about a lot of similar errors where different namespaces was the cause).
The code is running from my computer, both my computer and the one with the DB have access to the network folder with the XML and XSD files.

I’ve tried deliberately changing some field-names in both files, and the BulkLoader flares up throwing an error on the field I just changed.

I’ve compared both my BulkLoader code and the XSD to examples I’ve found on the net, and I can’t find any difference that would account for this behaviour.
It’s probably something easy I’m overlooking, but I’m just not seeing it atm.

Any help at all pointing me in the right direction is deeply welcomed.

Thank you in advance!

(P.S. Sorry if the post is off in some way, it’s my first time posting here, I did do my research however and I did try to follow the guidelines on how to post =) )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:17:30+00:00Added an answer on June 12, 2026 at 3:17 pm

    Following up on your suspicion that there might be a namespaces issue …

    The namespaces do match (between element instance and element declaration) for the elements that are qualified in the instance.

    But they don’t all match in the other direction; the schema declares an element whose expanded name is {http://schemas.servicestack.net/types}GetProductsResult, but no such element appears in the input instance (there is a GetProductsResult, but it’s not namespace-qualified).

    You might want to see what happens if you change the XML so that the first start-tag reads

    <GetProductsResult 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns="http://schemas.servicestack.net/types" >
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.