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

  • SEARCH
  • Home
  • 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 7698785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:19:25+00:00 2026-05-31T22:19:25+00:00

As a database developer with a very small amount of programming experience, I’m currently

  • 0

As a database developer with a very small amount of programming experience, I’m currently attempting to develop a C# .NET console application to import XML files into a SQL Server database. Once the import is done, I need to create a ‘Response’ file to be passed back to another application.

In doing my own research, I’ve come across the SQLBULKLOAD class. In fact, I’ve found some example code online that shows (at least partially) exactly what I’m trying to do:

using System;
using System.IO;
using System.Collections;
using SQLXMLBULKLOADLib;
using System.Data.OleDb;
using System.Diagnostics;
namespace SQLXmlExample
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            string schema = "C:\\ImportSample\\MappingFile.xml";
            string datafile = "C:\\ImportSample\\DataFile.xml";
            string connectionString = @"provider=SQLOLEDB;data source=localhost;database=SqlXmlDemo;Integrated Security=SSPI;";
            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i].ToLower())
                {
                    case "-schema": 
                            schema = args[i + 1];
                            break;
                    case "-datafile": 
                            datafile = args[i + 1];
                            break;
                }                            
            }
            if (schema == string.Empty || datafile == string.Empty)
            {
                Console.WriteLine("Missing Schema or Data File.  Format: SqlXmlExample -datafile [filename] -schema [filename]");
                return;
            }
            Load(datafile, schema, connectionString);
        }
        static public void Load(string XMLFilename, string XMLMappingFilename, string ConnectionString)
        {
            SQLXMLBULKLOADLib.SQLXMLBulkLoad loader = new SQLXMLBULKLOADLib.SQLXMLBulkLoad();
            loader.CheckConstraints = true;
            loader.XMLFragment = true;
            loader.SchemaGen = true;
            loader.SGDropTables = false;
            loader.Transaction = false;
            loader.ConnectionString = ConnectionString;
            loader.Execute("C:\\ImportSample\\MappingFile.xml", "C:\\ImportSample\\DataFile.xml");
        }
    }
}  

With the code above, I’m able to import an .XML file into a SQL Server instance. However, my problem is generating the ‘Response’ .XML file to provide information about the bulk loading operation (i.e. how many records were inserted, if the insert was successful).
As it stands now, I’m thinking that I may be using the wrong class for what I’m trying to accomplish. Am I using the correct class, or should I be using a different one?
If possible, could anyone point me in the direction of some more material to assist me? Any help would be greatly appreciated.

  • 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-05-31T22:19:26+00:00Added an answer on May 31, 2026 at 10:19 pm

    How about using the ErrorLogFile?

    This is where the bulk loader stores all its errors and messages, simply try one out, make it fail, see what the format is and then you can then load, parse and generate xml?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently in the research phase for a (very) small database application. It's for
In my last job, we worked on a very database-heavy application, and I developed
I'm an ASP.NET developer who has used Microsoft SQL Server for all my database
I work as a lone developer in a very small company. My work is
I recently started working on a small CMS. I usually develop .NET applications in
Although I'm primarily a database developer, one of my avocations has been application development.
I'm currently employed at a small ASP.NET/MS-SQL shop. My team has noticed that a
I'm attempting to create my first real C# application - a small pet project
I am preparing for the development of an enterprise-style application for a very small
Small introduction: I've tried to develop my project with sql database, entity framework, linq.

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.