SQLXMLBULKLOAD in Visual Studio express

Posted on 2009-12-26
Last Modified: 2013-11-27
I am trying to perfom a bulk load of XML to sql in ASP.Net and stuck on a problem for some time now
The method I believe I should use is SQLXMLBULKLOAD as defined in as this will allow me to map attributes and elements in the XML data to the SQL table using a mapping table.
To do this I need to import Interop.XBulkLoad4 and get  xblkld4.dll into the bin directory. However XBulkLoad4 cannot be loaded & I can't seem to load the dll.
How can I get SQLXMLBULKLOAD to work in Visual studio express I have SQL server 2008 installed.
assistance would be much appreciated
Question by:Simon Cripps
    LVL 26

    Expert Comment

    You have to install SQLXML 4.0 SP1 pack from here:

    Go down the page until you see "Microsoft SQLXML 4.0 SP1". Download the package that applies for you and install it properly.

    It says here:

    that is not installed by default with SQL 2008 Express.


    Author Comment

    by:Simon Cripps
    I have downloaded Microsoft SQLXML 4.0 SP1 howeverthis does not get SQLXMLBULKLOAD to work nor recognise either "Imports SQLXMLBULKLOADLib" or "Imports Interop.XBulkLoad4".
    From reading other comments I will need to get xblkld4.dll placed in the bin directory. This can apparently be done by using tlbimp.exe. I have searched all folders and cannot find the location of tlbimp.exe.
    Could you assist further to get SQLXMLBULKLOAD  to work.
    kind regards
    LVL 26

    Accepted Solution

    Maybe this will help:

    "In order to use the SQLXML Bulk Load COM object from a managed environment, you need to add a project reference to this object. This generates a managed wrapper interface around the Bulk Load COM object.

    Note   The SQLXML Bulkload component will not run in a multi-threaded environment ('[MTAThread]' attribute). If you get an InvalidCastException exception with the additional information: QueryInterface for interface SQLXMLBULKLOADLib.ISQLXMLBulkLoad failed.", then you are running into this issue. The workaround is to make the object that contains the bulkload object be single-thread accessible (for example using the [STAThread] attribute as shown in the sample)."

    Author Closing Comment

    by:Simon Cripps
    Very useful many thanks

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Viewers will learn how the fundamental information of how to create a table.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now