不推荐使用MSDatashape [英] MSDatashape being deprecated

查看:359
本文介绍了不推荐使用MSDatashape的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下Microsoft文档中:-

In the following microsoft documentation: -

https://docs.microsoft.com/zh-cn / sql / ado / guide / appendixes / microsoft-data-shaping-service-for-ole-db-ado-service-provider?view = sql-server-2017

此功能已被删除,建议使用XML。有人这样做吗?我想知道它们的含义,是使用XML加载MSDataShape的结构,还是仅使用XML对象?

this feature is being removed and the suggestion is to use XML. Has anyone done this? I'm wondering what they mean, in terms of loading the structure of what MSDataShape is by using XML, or just to use XML objects?

TIA

推荐答案

这对我很有帮助。我的MSDataShape代码仍然有效,因此我建议使用该代码来生成XML作为模板,然后再使用它来加载它们:-

This is my bit of code that is helpful. My MSDataShape code still works, therefore I propose using that to generate your XML as a template, then use that going forward to load them: -

Dim objShapeMaker   As clsShapeMaker
Dim rsoTemp         As ADODB.Recordset
Dim strXMLTemplate  As String

' Template file
strXMLTemplate = "C:\Temp\Template_GI.xml"

' Create the MSDataShape and save it to XML
Set rsoTemp = objShapeMaker.CreateGI()
rsoTemp.Save strXMLTemplate, adPersistXML

' Now we have the XML in a file going forward, load it in my recordset
Set rsoTemp = New ADODB.Recordset
rsoTemp.Open strXMLTemplate, , , , adCmdFile

' Cleanup
Set rsoTemp = Nothing
Set objShapeMaker = Nothing

不喜欢生成要维护的XML模板文件的想法,您可以通过.NET进行操作,并将其公开给COM以在您的VB6 / VBA应用程序中使用,如此处

If you don't like the idea of generating XML template files to maintain, you could do this via .NET and expose it to COM to use in your VB6/VBA application as mentioned here.

我已经制作了一个.NET应用程序,可以在任何人想要前进的情况下从简单的代码行生成这些XML文件,类似于列出的博客,但是它处理具有关系的子记录集。

I have made a .NET application that can generate these XML files from simple code lines should anyone want going forward that is similar to the blog listed, however it handles child recordsets with relationships.

编辑1 :如果您设置了架构而没有返回数据,则此方法非常有用。据我所知,要有效地填充它们,最好先编写代码以加载结构,然后从单独的记录集填充它(这比较慢!)。

EDIT 1: This works great if you have schema set ups without returning data. As far as I can tell, to populate these effectively, it's better to write code to load the structure first, and populate it after from seperate recordsets (which is slower!)

编辑2 :这是我们在.NET Interop中采用的替代方法。最初着眼于从SQL引入XML并根据需要对其进行解析。可以将其购回DataSet并也解析为目标记录集,但是结果数据集中表之间的关系需要在代码中设置,而不是在T-SQL中使用XML输出的位置。

EDIT 2: This is the approach we are taking with a replacement in a .NET Interop. Initially looking at bringing XML from SQL and parsing that back as required. This could be bought back into a DataSet and that's parsed into the target recordset as well, but then the relationship between the tables in the result dataset needs to be set in code rather than the one place in T-SQL with XML output.

这篇关于不推荐使用MSDatashape的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆