Saving DataSet as XML in ADO format using VB.NET

Hi,

I am trying to convert a lot of web reports from ASP/VB to
ASP.NET/VB.NET. I would like to save my dataset in XML and then use
XSLT to transform the XML. The catch is I would like to have the XML
in the format that ADO uses versus the default format in which ADO.NET
uses. Currently, I am using ADO within .NET, but I am concerned about
the performance and it might improve if I used the native data
providers for .NET. I am not sure if I am missing something but how do
I save the .NET DataSet to XML in the OLD ADO format?


Thanks for you help in advance and it is most appreciated.


In the old version fo the reports, the code is as follows:

Set lobjConnection = New ADODB.Connection
lobjConnection.ConnectionString = mstrConnectionString
lobjConnection.CursorLocation = adUseClient
lobjConnection.Open
        
Set lobjRecordset = lobjConnection.Execute(pstrSQL)
Set lobjDom = New MSXML2.DOMDocument40
lobjRecordset.Save lobjDom, 1

Set lobjXSL = New MSXML2.DOMDocument40
lobjXSL.Load (pstrXSLFilePath)
lstrHTML = (lobjDom.transformNode(lobjXSL))

The sample of XML from the old version of the reports is as follows:

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
	<s:Schema id="RowsetSchema">
		--"Schema Information"--
	</s:Schema>
	<rs:data>
		<z:row PENDING_CODE="001" PEND_CODE_DESCR="Missing Note Date"/>
	</rs:data>
</xml>

In the new version of the reports, using the native data provider, the
code is as follows:

Dim lobjDA As OracleDataAdapter
Dim lobjCmdBuilder As OracleCommandBuilder
Dim lobjDS As DataSet
Dim lobjXMLDataSet As XmlDataDocument

mobjConn = New OracleConnection(GetDSNFromCache())
mobjConn.Open()
mobjCmd = New OracleCommand(astrSQL, mobjConn)
lobjDA = New OracleDataAdapter(mobjCmd)
lobjCmdBuilder = New OracleCommandBuilder(lobjDA)
lobjDA.MissingSchemaAction = MissingSchemaAction.Add

lobjDS = New DataSet("DataSet")
lobjDS.Tables.Add("Results")
lobjDA.Fill(lobjDS, "Results")
lobjXMLDataSet = New XmlDataDocument(lobjDS)

Return lobjXMLDataSet.InnerXml

The sample of XML from the newversion of the reports is as follows:
<DataSet><Results><PENDING_CODE>001</PENDING_CODE><PEND_CODE_DESCR>Missing
Note Date</PEND_CODE_DESCR></Results></DataSet>
0
1/14/2004 4:55:19 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
1076 Views

Similar Articles

[PageSpeed] 56

Hi Shaileen,

Do not hit your desk in two when you read this.

Instead of using the DOM you can use

dataset.xmlread and dataset.xmlwrite

Very overloaded methods with schemas

I hope this helps?

Cor
> I am trying to convert a lot of web reports from ASP/VB to
> ASP.NET/VB.NET. I would like to save my dataset in XML and then use
> XSLT to transform the XML. The catch is I would like to have the XML
> in the format that ADO uses versus the default format in which ADO.NET
> uses. Currently, I am using ADO within .NET, but I am concerned about
> the performance and it might improve if I used the native data
> providers for .NET. I am not sure if I am missing something but how do
> I save the .NET DataSet to XML in the OLD ADO format?
>
>
> Thanks for you help in advance and it is most appreciated.
>
>
> In the old version fo the reports, the code is as follows:
>
> Set lobjConnection = New ADODB.Connection
> lobjConnection.ConnectionString = mstrConnectionString
> lobjConnection.CursorLocation = adUseClient
> lobjConnection.Open
>
> Set lobjRecordset = lobjConnection.Execute(pstrSQL)
> Set lobjDom = New MSXML2.DOMDocument40
> lobjRecordset.Save lobjDom, 1
>
> Set lobjXSL = New MSXML2.DOMDocument40
> lobjXSL.Load (pstrXSLFilePath)
> lstrHTML = (lobjDom.transformNode(lobjXSL))
>
> The sample of XML from the old version of the reports is as follows:
>
> <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
> xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
> xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
> <s:Schema id="RowsetSchema">
> --"Schema Information"--
> </s:Schema>
> <rs:data>
> <z:row PENDING_CODE="001" PEND_CODE_DESCR="Missing Note Date"/>
> </rs:data>
> </xml>
>
> In the new version of the reports, using the native data provider, the
> code is as follows:
>
> Dim lobjDA As OracleDataAdapter
> Dim lobjCmdBuilder As OracleCommandBuilder
> Dim lobjDS As DataSet
> Dim lobjXMLDataSet As XmlDataDocument
>
> mobjConn = New OracleConnection(GetDSNFromCache())
> mobjConn.Open()
> mobjCmd = New OracleCommand(astrSQL, mobjConn)
> lobjDA = New OracleDataAdapter(mobjCmd)
> lobjCmdBuilder = New OracleCommandBuilder(lobjDA)
> lobjDA.MissingSchemaAction = MissingSchemaAction.Add
>
> lobjDS = New DataSet("DataSet")
> lobjDS.Tables.Add("Results")
> lobjDA.Fill(lobjDS, "Results")
> lobjXMLDataSet = New XmlDataDocument(lobjDS)
>
> Return lobjXMLDataSet.InnerXml
>
> The sample of XML from the newversion of the reports is as follows:
> <DataSet><Results><PENDING_CODE>001</PENDING_CODE><PEND_CODE_DESCR>Missing
> Note Date</PEND_CODE_DESCR></Results></DataSet>


0
non1 (13)
1/14/2004 5:09:38 PM
Reply:

Similar Artilces:

Sometimes have to use "Rebuild All"
I have never noticed this before, but in this project I am working on right now, I made some changes and hit "F7" like normal, but it didn't detect the changes and didn't compile the new code. So for this one file I keep having to do a "rebuild all". Any ideas why this is happening and how to fix it? Yasoo wrote: >I have never noticed this before, but in this project I am working on right now, I made some changes and hit "F7" like normal, but it didn't detect the changes and didn't compile the new code. So for this one file I keep having to...

Handling of savings accounts and 401k accounts in the budget
I noticed that Money treats money that I contribute to a 401k account or transfer to a savings account as an expense. Basically, the more I contribute, the worse my budget looks. Is there a way to prevent this from happening? Right now, I exclude transfers to my savings account from the budget and it solves the problem, however, I shouldn't have to manually do this each time. For 401k contributions, I cannot find a way to do this. Why does it show up as "an expense" (what Category???) instead of something like Transfer Out of Budget Accounts? The 401k cash account sh...

Email address format with a twist
Exchange 2003 SP2. We currently have email addresses in the form of jdoe@domain.com. We would like to add an additional address of john.doe@domain.com and set it to be the primary address. All new accounts would then follow this new format. I know I can edit the recipient policy for the default domain to be %g.%s@domain.com. However, and here's the twist: we receive a daily .csv file from HR that has all employees Given Name, Preferred Name, Last Name, etc. We then programmitcally sync this with AD whereby Given Name goes into the First Name field, Last Name goes into the L...

FileNotFound returned by Bitmap::Save() when saving to stream
I have a little chunk of code which is supposed to take a bitmap image and save its PNG encoding into a block of memory. The problem is, I keep getting a FileNotFound error back from Save(). If anyone has any ideas, I'd love to hear them. Here's the code (more or less) in question; there really shouldn't be much to it, I would have thought: /* Allocate an IStream object to write the data into a global memory block. We indicate that the handle to the underlying data will be freed when the stream object is released. */ VERIFY(S_OK == ::CreateStreamOnHGlobal(nil, True, static_c...

Using word templates as email
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I want to ask how I use a word template as an email template? I have found an easy solution for PC on MS own website but it does not apply for Mac...I know this must be straightforward but simply select-all, cut, paste into new message does not work and template falls apart....help !!!! You can't do that in Microsoft Office for Mac. You have to write the email in Word then use File>Send to>Mail recipient (as HTML) from inside Word. It still makes a mess of it. Best to simply forget about it: ...

Unable to save password in Outlook 2003
I cannot seem to save my "network password" for Outlook 2003. I tried everything I can think of. I tried editing the registry. I use XP. I try going into Control Panel, go to mail and go thru the process there and....nothing worked there. I uninstalled Office the reinstalled it.....nothing! I even went as far as unistalling my internet software, still...nothing! Someone told me that XP will not save passwords. My Outlook express works fine. Someone HELP! I also had this issue in Outlook 2003, but also in indows Live Messenger and Internet Explorer 7. I spend hour...

what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document?
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel wrote: > what encoding does system.xml.xmldocument.save(string path) use to save the > xml document if there is no <?xml... in the front of the xml document? UTF-8 is the default encoding. -- Oleg Tkachenko [XML MVP, MCPD] http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net utf8 i suppose would be default Vinu Baby "Daniel" <softwareengineer98037@yahoo.com> wrote in message news:e8#...

Distribution List to use multiple emails for contact
I am trying to setup a Distribution List and want to include all email accounts setup for that contact when sending a message out. Currently I can only send out to the default email account. Is there a way to get this to work? The sending account is chosen at the time you send a message. It is not a property of either a Contact or a DL. -- Russ Valentine [MVP-Outlook] "Tiffany" <tslaton@nuvox.net> wrote in message news:1783701c41deb$2ad1a940$a601280a@phx.gbl... > I am trying to setup a Distribution List and want to > include all email accounts setup for that conta...

Conditional Formatting based on month name
I have a sheet where C2 contains the typed text of a month, i.e. February. Range C4:D14 contains actual dates spanning several months. I would like to highlight the cells that contain the month in C2. I've floundered around for several hours without a solution. Any help? P.S. I need C2 to remain text so it won't change until I change it. -- David Try: Select C4:D14 Click Format > Conditional Formatting Under Condition 1, make the settings as: Formula Is| =AND(TEXT(C4,"mmmm")=$C$2,C4<>"") Click Format button > Patterns tab > Light brown? >...

Save and save as
Hi, I am looking for some help with a macro, I need to disable anyone from saving a file or save as and also disable the prompt if the close button is pressed you get an option to save the file then, I need to disable all of these, also have a pop up box to warn that save as been disables when a user tries to save the file fro save and save as. Can anyone help me with this. I am using word 2003 Regards Mark Once you give someone access to a document, you have ceded all control over it. You can however stop them from overwriting the original file by making the doc...

Saving Images
When I right click to save an image in an email, it will only save as a .bmp. I need to use it as a .jpeg or a .gif. How can I fix this? In news:AB8040CE-5975-4A14-87BD-BE3B97E33682@microsoft.com, Angi <Angi@discussions.microsoft.com> typed: > When I right click to save an image in an email, it will only save as > a .bmp. I need to use it as a .jpeg or a .gif. How can I fix this? Clear your internet explorer temp file cache.....go to control panel, internet options, and choose 'delete files' "Angi" <Angi@discussions.microsoft.com> wrote in message...

"Unattainable" savings goals
I've learned to mostly ignore it, but it drives me batty. I have a particular loan with a goal to pay it off by 7/4/04. The loan balance is 14,000. I have marked a savings account to be "used for budgeted savings goals." I deposit $1300 per month into the account which has a balance currently of $13000. Money 2K4 says that I cannot reach my savings goal. What can I do to help fix this? Any feedback would be appreciated! ...

Using Outlook 2000--some users send attachments that don't get received
We have a problem at my office. Several of our users are sending out attachments in Word and Excel. One user can send the documents and the recipients get the attachments. Two others send the documents as attachments, but the recipients don't get the attachments. All of the Outlook 2000 clients have "Rich Text Format" as the sending format, even the one who doesn't have problems. What else should I be looking for? If the recipient isn't using Outlook, they will not receive the attachments as long as your users are using RTF. "Brent White" <bwhite@bad...

conditional format based on rank?
is there any way to use a conditional format formula to rank the numbers in column of a pivot table or a range? example: top score : cell pattern red 2nd highest: cell pattern blue 3rd highest: cell pattern yellow > is there any way to use a conditional format formula to rank the > numbers in column of a pivot table or a range? > > example: > > top score : cell pattern red > 2nd highest: cell pattern blue > 3rd highest: cell pattern yellow Use these 3 Conditional Format formulas... Condition 1 ========== Formula is: =C1=LARGE(C:C,1) Format: Pattern --...

How to do XML parsing?
I need to know how to set up XML parsing. In the past, I've always written my own parsing routines but this time I'd like to use Microsoft's own DOM helper classes but looking at MSDN has left me more confused than ever. Could one of you wizards be so good as to explain in words of one syllable or less how 1) Microsoft's XML DOM helpers work 2) How to include in a project 3) How to use ---------- Richard Lewis Haggard would these help? http://www.codeguru.com/Cpp/misc/misc/article.php/c3707/ http://www.codeguru.com/Cpp/data/data-misc/xml/article.php/c4585/ http://www...

Date format problem
In my Excel files,when I click a cell that contain "date" it changes into dd/mm/yyyy format.But,in the formula bar,the same date is displayed in mm/dd/yyyy format.Why it is so? I want all the dates in dd/mm/yyyy format only.Will there be any problem while sorting if the date column contais dates of different formats i.e. dd/mm/yyyy and mm/dd/yyyy as well? You can check the cells format for date format and choose a date format that has a * in front of it this doesnt change with system settings, you should also check your computers language setting and check the settings in...

Formatting: Display a minus sign before a number
How do I format a number so that it display a minus sign before the number. I have a spreadsheet that was created by someone else, and it does this, but I cannot figure out how to do it! Is it all or part of the numbers in a column? Either way, enter the number in the cell with a - sign. Then click on the column, select FORMAT>CELLS>NUMBER, select the type of number you are using (currency, general, number, etc.) and you'll see a box for negative numbers. Pick your pleasure and voila--it will show that way on your spreadsheet. If you'[ll right-click a cell, a window pops ...

Problem using MAPIOBJECT from calendar item
I have a program that uses the Outlook Object Model to gather info from a calendar. Since upgrading to Outlook 2003 I am trying to avoid the Outlook Object Security warning dialog when I get the calendar item body. I am trying to use the GetMAPIOBJECT() method of the AppointmentItemPtr to see if using that interface will allow me to get the body text without the warning. I have tried two methods for the mapiobject; coerce the returned point into an IMessage pointer and do a QueryInterface() on the returned IUnknown pointer. Neither succeeds. If I coerce the pointer I get an exception when ...

Saving default tabs
I can't seem to get a change in the default tab setting to save. When I reopen publisher the tab setting reverts to .5 which was original default. I'm I the only person who is having this problem? I'm using the 2003 verson but had the same problem with 2000. Why not take the default page, set the tabs you want and save it as a template with a file name of, "My Very Special Tabs Settings for Future Files.pub" (jerking your chain a bit<G>) Then when you want to create what you want, use your created template file and when your pub file is what you want, do a Sa...

VB6 service under Server 2008 can't run another VB application
I have a VB6 service that has been running for years on 2000 and 2003. I'm trying get it to work on Server 2008 and it's not working. The service calls shell to run another VB6 .exe program. This .exe program is not being called when the VB6 service program is run as a service. If I run the program as an application, it works like it should. Obviously, something in 2008 needs to be changed to allow this but I don't know what it would be. sr Steve Ricketts brought next idea : > I have a VB6 service that has been running for years on 2000 and 2003. I'm...

Save to unProtect a Document?
Our company has word documents that we use as templates on a fileserver. How could I protect the documents so that when they open them, they dont make changes to the server version, but save their OWN version and do what they want? First of all, make use of true *template* files (with the *.dot or *.dotx extension). Also, assign the template files the read-ony attribute. -- Stefan Blom Microsoft Word MVP "Chris" <Chris@discussions.microsoft.com> wrote in message news:EB9D352D-823F-4126-8A00-2D90516A3FA1@microsoft.com... > Our company has word docum...

Row Formatting #3
Hi All, How can I format a complete row or range automatically, depending on Cell value or comparison between 2 values at different cells. ? Conditional formating is doing this just for one cell only and depending on the value of this cell. Any solution. -- ********* IT Manager DeLaval Ltd. Cairo-Egypt ********* |-----------------------------| |Islam is peace not Terror| |-----------------------------| Hi conditional formating can do this as well: - select the row (e.g. row 1) - goto Conditional Format dialog - enter the following formula =$A1>1 - choose your format This will for...

when I save an email, where does it save to?
Hi all, I have several emails that I wanted to reply, and I did click "reply" and then wrote something, but I did not have time to finish... then I click on "save", and in the evening, I closed the outlook because I slept... now I reopen the outlook in the morning, and I want to find my saved unfinished replies that I was writing... But where to find them? I have a "draft" folder, but those saved emails do not seem to be in this folder... wherelse could they go? ---------------------------------------------- This is annoying... is there a way to automat...

merge catalog -numbers format
I am trying to merge a database that includes numbers with currency format or percentages. Is there any trick to bring the same format to publisher? Thanks Gene Format the field as text... -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Gene" <Gene@discussions.microsoft.com> wrote in message news:6B746AA0-CB95-4051-BB4B-CF7307D1AA21@microsoft.com... >I am trying to merge a database that includes numbers with currency format or > percentages. Is there any trick to bring the same format to publisher? > >...

Save csv format to dbf format
I have a .csv file with 13 columns of data opened in excel. I make a few changes to a field and then want to save to .dbf format. After saving as .dbf when I open the file only column 1 data is present. Any insights into where the rest of the data goes? Why does the data disappear? Thanks, Mike -- mdelasaux ------------------------------------------------------------------------ mdelasaux's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28889 View this thread: http://www.excelforum.com/showthread.php?threadid=486365 Try using Notepad and open your .dbf...