简体   繁体   English

使用Visual Studio 2010将XML批量加载到SQL Server 2012中

[英]Bulk Loading XML Into SQL Server 2012 using Visual Studio 2010

I need to figure out how I can bulk load XML into Microsoft SQL Server 2012 using Visual Studio 2010. I have followed the instructions here , but this gets me a long list of errors (included below). 我需要弄清楚如何使用Visual Studio 2010将XML批量加载到Microsoft SQL Server 2012中。我已经按照此处的说明进行操作,但这会为我带来一长串错误(包括在下面)。

Additionally, I'm not entirely sure what I'm supposed to do with the instructions for #8: "Replace the Main() method with the following code. Update the ConnectionString property and the file path to the schema and data files." 此外,我不完全确定我应该对#8的指令做什么:“用以下代码替换Main()方法。将ConnectionString属性以及模式和数据文件的文件路径更新。” Can someone give me a quick rundown, please? 有人可以给我一个简短的摘要吗?

Though I'm not sure it will help, I also added the SQL DB as a data source. 尽管我不确定是否会有所帮助,但我还添加了SQL DB作为数据源。

Error 1: 错误1:

The type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' has no constructors defined C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 15 64 Aztech - Bulk Load 类型'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'没有定义构造函数C:\\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 15 64 Aztech-批量加载

Error 2: 错误2:

'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' does not contain a definition for 'ConnectionString' and no extension method 'ConnectionString' accepting a first argument of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' could be found (are you missing a using directive or an assembly reference?) C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 16 23 Aztech - Bulk Load 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'不包含'ConnectionString'的定义,也找不到扩展方法'ConnectionString'接受类型为'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'的第一个参数(您是否缺少using指令或程序集引用?)C: \\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 16 23 Aztech-批量加载

Error 3: 错误3:

'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' does not contain a definition for 'ErrorLogFile' and no extension method 'ErrorLogFile' accepting a first argument of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' could be found (are you missing a using directive or an assembly reference?) C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 17 23 Aztech - Bulk Load 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'不包含'ErrorLogFile'的定义,并且找不到扩展方法'ErrorLogFile'接受类型为'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'的第一个参数(您是否缺少using指令或程序集引用?)C: \\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 17 23 Aztech-批量加载

Error 4: 错误4:

'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' does not contain a definition for 'KeepIdentity' and no extension method 'KeepIdentity' accepting a first argument of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' could be found (are you missing a using directive or an assembly reference?) C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 18 23 Aztech - Bulk Load 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'不包含'KeepIdentity'的定义,并且找不到扩展方法'KeepIdentity'接受类型为'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'的第一个参数(您是否缺少using指令或程序集引用?)C: \\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 18 23 Aztech-批量加载

Error 5: 错误5:

'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' does not contain a definition for 'Execute' and no extension method 'Execute' accepting a first argument of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' could be found (are you missing a using directive or an assembly reference?) C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 19 23 Aztech - Bulk Load 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'不包含'Execute'的定义,也找不到扩展方法'Execute'接受类型为'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class'的第一个参数(您是否缺少using指令或程序集引用?)C: \\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 19 23 Aztech-批量加载

Error 6: 错误6:

Interop type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' cannot be embedded. 无法嵌入互操作类型“ SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class”。 Use the applicable interface instead. 请改用适用的界面。 C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 15 35 Aztech - Bulk Load C:\\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 15 35 Aztech-批量加载

Error 7: 错误7:

Interop type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' cannot be embedded. 无法嵌入互操作类型“ SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class”。 Use the applicable interface instead. 请改用适用的界面。 C:\\Users\\coopere.COOPERE-PC\\documents\\visual studio 2010\\Projects\\Aztech - Bulk Load\\Aztech - Bulk Load\\Program.cs 15 86 Aztech - Bulk Load C:\\ Users \\ coopere.COOPERE-PC \\ documents \\ visual studio 2010 \\ Projects \\ Aztech-批量加载\\ Aztech-批量加载\\ Program.cs 15 86 Aztech-批量加载

Thanks for your help in advance. 感谢您的帮助。

I am working on the same thing except I am using Visual Studio 2012. Use SQLXMLBULKLOADLib.SQLXMLBulkLoad4 instead of SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class it works for me. 除了使用Visual Studio 2012外,我正在做同一件事。它对我有用,而不是SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class而不是SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class。 Everything else in the example should work then. 然后,示例中的其他所有内容都将起作用。 Once you build your application if there are problems in your xsd or xml files you will get runtime COM errors. 如果您的xsd或xml文件中存在问题,则一旦构建应用程序,您将收到运行时COM错误。

The code inside the main method is what performs the bulk load. main方法中的代码是执行大容量加载的代码。 Your first error is because SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class has no constructor (eg the method which is called when new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class). 您的第一个错误是因为SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class没有构造函数(例如,在新建SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class时调用的方法)。 The instantiation of the class object should look similar to this: 类对象的实例应类似于以下内容:

SQLXMLBULKLOADLib.SQLXMLBulkLoad4 objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4(); SQLXMLBULKLOADLib.SQLXMLBulkLoad4 objBL =新的SQLXMLBULKLOADLib.SQLXMLBulkLoad4();

As far as the data.xml, schema.xml files go they either need to be in the same folder as the executable file or you need to put the full path. 至于data.xml,schema.xml文件,它们要么需要与可执行文件位于同一文件夹中,要么需要放置完整路径。 Hope this help let me know if you need any further clarification. 希望此帮助让我知道是否需要进一步说明。

Question for you....Were you able to find the mapping-schema xsd file which the example references. 您的问题。...您能够找到该示例引用的mapping-schema xsd文件。 It's not a huge deal but I get a lot of info messages because that file was not included with the Visual Studio xsd files. 这没什么大不了的,但是我得到了很多信息消息,因为该文件未包含在Visual Studio xsd文件中。 I've searched everywhere, but was only able to find some old posting of the contents of the file which doesn't have everything in the current bulkload documentation. 我到处搜索过,但是只能找到文件内容的一些旧内容,而该内容在当前的批量加载文档中没有全部内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有Visual Studio 2010和Entity Framework兼容性的MS SQL Server 2012 - MS SQL Server 2012 with Visual Studio 2010 and Entity Framework compatibility 使用Visual Studio服务器资源管理器连接到远程SQL Server 2012 - Connect to remote SQL server 2012 using visual studio server explorer 如何在Visual Studio 2010中使用SQL Server 2012数据库打包和部署C#桌面应用程序? - How to package and deploy a C# desktop application with a SQL Server 2012 database in Visual Studio 2010? 使用Visual Studio 2010的Windows App的SQL Server Compact - Sql server compact for windows app using visual studio 2010 Sql 服务器未在 Visual Studio 中加载 - Sql server is not loading in visual studio 没有SQL Server的Visual Studio 2012安装 - Visual Studio 2012 installation without SQL Server SQL Server 2008和Visual Studio 2012 - SQL Server 2008 and Visual Studio 2012 LINQ查询到visual studio 2010或2012中的sql查询生成器 - LINQ query to sql query generator in visual studio 2010 or 2012 生成Web.config以将数据从文件加载到Visual Studio 2012中的MS SQL 2008服务器数据库 - generate Web.config for loading data from a file to MS SQL 2008 server database in Visual Studio 2012 Visual Studio 2010项目到Visual Studio 2012 - Visual Studio 2010 project to Visual Studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM