问题
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?
回答1:
Unfortunately I don't believe there is, you have to add these things manually, as far as I'm aware. The upside is that it isn't too difficult, though, providing you don't hit any weird hiccups.
If you post your XSD and table structure maybe I can give you a hand.
来源:https://stackoverflow.com/questions/4039085/xsd-schema-file-must-be-annotated-in-sqlxmlbulkloadlib-sqlxmlbulkload4class