views:

8

answers:

0

Here is an example to use SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class -

[STAThread]
   static void Main(string[] args)
   {   
         try
         {
            SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();
            objBL.ConnectionString = "Provider=sqloledb;server=server;database=databaseName;integrated security=SSPI";
            objBL.ErrorLogFile = "error.xml";
            objBL.KeepIdentity = false;
            objBL.Execute ("schema.xml","data.xml");
         }
         catch(Exception e)
         {
         Console.WriteLine(e.ToString());
         }
   }

It seems that schema.xml must be annotated with sql information to make importing successful. Regular xsd file does not work.

Is there any tools or ways to automate the generation of annotate information basing on xsd file? I could not find any through Internet Search. I wonder how SSIS can achieve this. Is there any component doing this so I can include it in my .NET application?