SQLXMLBulkLoad4Class error execute

  • Thread starter Thread starter Ricardo M.S. _
  • Start date Start date
R

Ricardo M.S. _

Guest
Good Afternoon,


Im try create tables in sql server from one xsd file. I use the sqlbulkload but give me the error on execute the file.

But when the read file with dataset I know the tables, fields, and data types I dont understand why give the error.

private void button1_Click(object sender, EventArgs e)
{

SQLXMLBulkLoad4Class objBL = new SQLXMLBulkLoad4Class();
objBL.ConnectionString = "Provider=SQLNCLI11;server=RICSERVER; database=Saft;integrated security=SSPI";


objBL.BulkLoad = true;
objBL.SchemaGen = true;
objBL.SGUseID = true;
objBL.CheckConstraints = true;
objBL.ForceTableLock = true;
objBL.KeepIdentity = false;
objBL.ErrorLogFile = @"C:\Bases de Dados\error.txt";
objBL.Execute(@"C:\Bases de Dados\New.XSD");


DataSet dsExport = new DataSet();
dsExport.ReadXmlSchema(@"C:\Bases de Dados\New2.XSD");


DataTableCollection collection = dsExport.Tables;
for (int i = 0; i < collection.Count; i++)
{
DataTable table = collection;

foreach (DataColumn column in table.Columns)
{
listBox1.Items.Add(table.TableName + "->" + column.ColumnName.ToString() + ":->" + column.DataType.ToString() );
}
}


}




System.Runtime.InteropServices.COMException was unhandled
HResult=-2147418113
Message=Schema: relationship expected on Address.
Source=Schema mapping
ErrorCode=-2147418113
StackTrace:
at SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class.Execute(String bstrSchemaFile, Object vDataFile)
at SAFT.Form1.button1_Click(Object sender, EventArgs e) in c:\Users\Ricardo Sousa\Documents\Visual Studio 2012\Projects\NEW\NEW\Form1.cs:line 49
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SAFT.Program.Main() in c:\Users\Ricardo Sousa\Documents\Visual Studio 2012\Projects\SAFT\SAFT\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:


Continue reading...
 

Similar threads

Back
Top