473,835 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return xml

The following function is used in my webservice which
returns a dataset.
I now need to return the dataset as xml and have no idea
how to do it.
Can anyone help ?
Thanks in Advance

Expand|Select|Wrap|Line Numbers
  1. Private Function GetDataSetXML(ByVal strSQL As String) As
  2. dataset
  3. '1. Create a connection
  4. Dim connString As String
  5. connString
  6. = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
  7. & "C:\blobdata\data.mdb" & ";"
  8. Dim myConnection As New OleDbConnection(connString)
  9. '2. Create the command object, passing in the SQL
  10. string
  11. Dim myCommand As New OleDbCommand(strSQL,
  12. myConnection)
  13. myConnection.Open()
  14. '3. Create the DataAdapter
  15. Dim myDataAdapter As New OleDbDataAdapter()
  16. myDataAdapter.SelectCommand = myCommand
  17. '4. Populate the DataSet and close the connection
  18. Dim myDataSet As New DataSet()
  19. myDataAdapter.Fill(myDataSet)
  20. myConnection.Close()
  21. 'Return the DataSet
  22. Return myDataset
  23. End Function
  24.  
Nov 12 '05 #1
1 1833
Take a look at:

http://msdn.microsoft.com/library/en...asp?frame=true

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

<an*******@disc ussions.microso ft.com> wrote in message
news:34******** *************** *****@phx.gbl.. .
The following function is used in my webservice which
returns a dataset.
I now need to return the dataset as xml and have no idea
how to do it.
Can anyone help ?
Thanks in Advance

Expand|Select|Wrap|Line Numbers
  1.   Private Function GetDataSetXML(ByVal strSQL As String) As
  2.  dataset
  3.          '1. Create a connection
  4.          Dim connString As String
  5.          connString
  6.  = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
  7.  & "C:\blobdata\data.mdb" & ";"
  8.          Dim myConnection As New OleDbConnection(connString)
  9.          '2. Create the command object, passing in the SQL
  10.  string
  11.          Dim myCommand As New OleDbCommand(strSQL,
  12.  myConnection)
  13.          myConnection.Open()
  14.          '3. Create the DataAdapter
  15.          Dim myDataAdapter As New OleDbDataAdapter()
  16.          myDataAdapter.SelectCommand = myCommand
  17.          '4. Populate the DataSet and close the connection
  18.          Dim myDataSet As New DataSet()
  19.          myDataAdapter.Fill(myDataSet)
  20.          myConnection.Close()
  21.          'Return the DataSet
  22.          Return myDataset
  23.      End Function
  24.  

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4532
by: Phil Powell | last post by:
My first time working with a PHP class, and after 6 hours of working out the kinks I am unable to return a value from the class, so now I appeal to the general audience what on earth did I do wrong this time? This is the code the retrieves the values: if (($hasRegistered || $hasPreRegistered) && !empty($uplinenumber)) { // CHECK TO SEE IF UPLINE NUMBER IS A VALID NUMBER $regNumberGenerator = new RegNumberGenerator($uplinenumber,...
20
2357
by: Jakob Bieling | last post by:
Hi! I am using VC++ 7.1 and have a question about return value optimization. Consider the following code: #include <list> #include <string> struct test {
25
4151
by: cppaddict | last post by:
I'd like to know what goes on under the hood when methods return objects. Eg, I have a simple Point class with two members _x and _y. It's constructor, copy constructor, assignment operator and additon operator (which returns another Point object, and which my question is about) are as follows: Point::Point(int x, int y) : _x(x), _y(y) { }
2
2351
by: PengYu.UT | last post by:
I have the following sample program, which can convert function object with 1 argument into function object with 2 arguments. It can also do + between function object of the same type. The last line is very long. I'm wondering if there is any way to suppress it. I can only think of typedef. But I'm not sure whether I can use typedef for the return type. Would you please help me? Please don't be daunted by the length of the code.
2
4677
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info Center: To return a result set from a procedure to the originating application, use the WITH RETURN TO CLIENT clause. When WITH RETURN TO CLIENT is specified on a result set, no nested procedures can access the result set.
15
6739
by: Greenhorn | last post by:
Hi, when a function doesn't specify a return type ,value what value is returned. In the below programme, the function sample()is returning the value passed to 'k'. sample(int); main() { int i = 0,j; j = sample(0);
10
19165
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back the correct answers to a C++ " int SumArray(int ray, int count)" Now I'm having problems with C++ "return(false)" being True in C#. Here is the C# code. ========================= using System; using System.Runtime.InteropServices; //
12
3805
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk. 1. The Deserialization goes like: #Region " Load "
3
4553
by: kikazaru | last post by:
Is it possible to return covariant types for virtual methods inherited from a base class using virtual inheritance? I've constructed an example below, which has the following structure: Shape = base class Triangle, Square = classes derived from Shape Prism = class derived from Shape TriangularPrism, SquarePrism = classes derived from Triangle and Prism, or Square and Prism respectively
6
2415
KoreyAusTex
by: KoreyAusTex | last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the getValue()? import java.util.*; public class Card { // instance variables //suits private int suit; private int spades;
0
10812
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10523
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10235
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9346
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5804
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3089
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.