SQLXML Bulk Loader
До установки Microsoft SQLXML BulkLoad 4.0, требуется установить msxml.msi.До установки Microsoft SQLXML BulkLoad 4.0, требуется установить msxml.msi.Установлено с https://www.microsoft.com/en-us/download/details.aspx?id=30403По умолчанию Microsoft SQLXML BulkLoad 4.0 Type Library не показывается в при добавлении ссылки проекта во вкладке COM Visual Studio.Чтобы добавить нужно использовать команду - regsvr32 "C:\Program Files\Common Files\System\Ole DB\xblkld4.dll". для X64 - On a 64-bit version of Windows, there are two versions of the Regsvr32 tool.
The 64-bit version is %systemroot%\System32\regsvr32.exe.The 32-bit version is %systemroot%\SysWoW64\regsvr32.exe.
According to your project platform (x86 or x64), please use the appropriate Regsvr32 tool to register the DLL.
Note: If you are using Windows Vista or Windows 7, please right-click on Command Prompt, select Run as administrator and then run the command.
Ссылка на источник: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f974763f-b189-456d-8b9a-6100d46cae15/cannot-find-microsoft-sqlxml-bulkload-40-type-library-in-com-list?forum=sqlxml
пример:
public static void XmlToTable(string schema, string xml) { SQLXMLBULKLOADLib.SQLXMLBulkLoad4 objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4(); objBL.ConnectionString = @"provider=sqloledb;Data Source =testerismo\\selena;Initial Catalog=Eris; User ID=Tempadmin;Password=3emp4m!N;persist security info=True;Connect Timeout=30; Application Name=Portal2009;"; objBL.ErrorLogFile = "error.xml"; objBL.KeepIdentity = false; objBL.Execute(schema, xml); }
пример схемы xsd:
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo> <sql:relationship name="RespErr" parent="export.FRLLOPatientsResponses" parent-key="Id" child="export.FRLLOPatientsResponseErrors" child-key="FRLLOPatientsResponseId" />
</xsd:appinfo> </xsd:annotation>
<xsd:element name="element" sql:relation="export.FRLLOPatientsResponses" sql:key-fields="Id"> <xsd:complexType> <xsd:sequence>
<xsd:element name="document_id" sql:field="DocumentId" type="xsd:string" />
<xsd:element name="reg_num" sql:field="RegNum" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="status" sql:field="Status" type="xsd:string" />
<xsd:element name="errors" minOccurs="0" maxOccurs="1" sql:is-constant="0">
<xsd:complexType> <xsd:sequence > <xsd:element name="element" sql:relation="export.FRLLOPatientsResponseErrors" sql:relationship="RespErr"> <xsd:complexType> <xsd:sequence >
<xsd:element name="code" sql:field="Code" type="xsd:int" /> <xsd:element name="description" sql:field="Description" type="xsd:string" />
</xsd:sequence> </xsd:complexType>
</xsd:element> </xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>