Professional Web Applications Themes

return xml - ASP.NET Web Services

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 Code: Private Function GetDataSetXML(ByVal strSQL As String) As dataset '1. Create a connection Dim connString As String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\blobdata\data.mdb" & ";" Dim myConnection As New OleDbConnection(connString) '2. Create the command object, passing in the SQL string Dim myCommand As New OleDbCommand(strSQL, myConnection) myConnection.Open() '3. Create the DataAdapter Dim myDataAdapter As New OleDbDataAdapter() myDataAdapter.SelectCommand = myCommand '4. Populate the DataSet and ...

  1. #1

    Default 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

    Code:
    Private Function GetDataSetXML(ByVal strSQL As String) As
    dataset
    '1. Create a connection
    Dim connString As String
    connString
    = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    & "C:\blobdata\data.mdb" & ";"
    Dim myConnection As New OleDbConnection(connString)
    '2. Create the command object, passing in the SQL
    string
    Dim myCommand As New OleDbCommand(strSQL,
    myConnection)
    myConnection.Open()
    '3. Create the DataAdapter
    Dim myDataAdapter As New OleDbDataAdapter()
    myDataAdapter.SelectCommand = myCommand
    '4. Populate the DataSet and close the connection
    Dim myDataSet As New DataSet()
    myDataAdapter.Fill(myDataSet)
    myConnection.Close()
    'Return the DataSet
    Return myDataset
    End Function

    Poppy Guest

  2. #2

    Default Re: return xml

    Every response of a webservice is in XML...

    Can you be a little more specific what your requirements for that xml are?

    --
    Greetz,
    Jan
    ________________________
    Read my weblog: [url]http://weblogs.asp.net/jan[/url]

    "Poppy" <paul.diamondNOSPAMthemedialounge.com> schreef in bericht
    news:uBYht9RKEHA.1340TK2MSFTNGP12.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
    >
    >
    Code:
    >  Private Function GetDataSetXML(ByVal strSQL As String) As
    > dataset
    >         '1. Create a connection
    >         Dim connString As String
    >         connString
    > = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    > & "C:\blobdata\data.mdb" & ";"
    >         Dim myConnection As New OleDbConnection(connString)
    >         '2. Create the command object, passing in the SQL
    > string
    >         Dim myCommand As New OleDbCommand(strSQL,
    > myConnection)
    >         myConnection.Open()
    >         '3. Create the DataAdapter
    >         Dim myDataAdapter As New OleDbDataAdapter()
    >         myDataAdapter.SelectCommand = myCommand
    >         '4. Populate the DataSet and close the connection
    >         Dim myDataSet As New DataSet()
    >         myDataAdapter.Fill(myDataSet)
    >         myConnection.Close()
    >         'Return the DataSet
    >         Return myDataset
    >     End Function
    >
    >
    >

    Jan Tielens Guest

  3. #3

    Default Re: return xml

    Have you looked at the various methods of a DataSet that express its
    contents as XML (writeXML, getXML)?


    "Poppy" <paul.diamondNOSPAMthemedialounge.com> wrote in message
    news:uBYht9RKEHA.1340TK2MSFTNGP12.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
    >
    >
    Code:
    >  Private Function GetDataSetXML(ByVal strSQL As String) As
    > dataset
    >         '1. Create a connection
    >         Dim connString As String
    >         connString
    > = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    > & "C:\blobdata\data.mdb" & ";"
    >         Dim myConnection As New OleDbConnection(connString)
    >         '2. Create the command object, passing in the SQL
    > string
    >         Dim myCommand As New OleDbCommand(strSQL,
    > myConnection)
    >         myConnection.Open()
    >         '3. Create the DataAdapter
    >         Dim myDataAdapter As New OleDbDataAdapter()
    >         myDataAdapter.SelectCommand = myCommand
    >         '4. Populate the DataSet and close the connection
    >         Dim myDataSet As New DataSet()
    >         myDataAdapter.Fill(myDataSet)
    >         myConnection.Close()
    >         'Return the DataSet
    >         Return myDataset
    >     End Function
    >
    >
    >

    Scott M. Guest

  4. #4

    Default Re: return xml

    maybe you mean an untyped XML string?

    Private Function GetDatasetAsXmlString(...) as String
    return myDataSet.getXML()
    End Function

    "Scott M." <s-marBADSPAMsnet.net> wrote in message
    news:eRGJaZVKEHA.2776TK2MSFTNGP12.phx.gbl...
    > Have you looked at the various methods of a DataSet that express its
    > contents as XML (writeXML, getXML)?
    >
    >
    > "Poppy" <paul.diamondNOSPAMthemedialounge.com> wrote in message
    > news:uBYht9RKEHA.1340TK2MSFTNGP12.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
    > >
    > >
    Code:
    > >  Private Function GetDataSetXML(ByVal strSQL As String) As
    > > dataset
    > >         '1. Create a connection
    > >         Dim connString As String
    > >         connString
    > > = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    > > & "C:\blobdata\data.mdb" & ";"
    > >         Dim myConnection As New OleDbConnection(connString)
    > >         '2. Create the command object, passing in the SQL
    > > string
    > >         Dim myCommand As New OleDbCommand(strSQL,
    > > myConnection)
    > >         myConnection.Open()
    > >         '3. Create the DataAdapter
    > >         Dim myDataAdapter As New OleDbDataAdapter()
    > >         myDataAdapter.SelectCommand = myCommand
    > >         '4. Populate the DataSet and close the connection
    > >         Dim myDataSet As New DataSet()
    > >         myDataAdapter.Fill(myDataSet)
    > >         myConnection.Close()
    > >         'Return the DataSet
    > >         Return myDataset
    > >     End Function
    > >
    > >
    > >
    >
    >

    Dino Chiesa [Microsoft] Guest

Similar Threads

  1. return SQL ID
    By aredovian in forum Macromedia ColdFusion
    Replies: 0
    Last Post: March 18th, 06:44 PM
  2. goToNetPage, return or not return
    By GONS in forum Macromedia Director Basics
    Replies: 1
    Last Post: January 16th, 08:44 PM
  3. How to return my own XML?
    By Christopher Ambler in forum ASP.NET Web Services
    Replies: 2
    Last Post: September 20th, 03:30 AM
  4. Return Key
    By Ethan in forum Mac Portable
    Replies: 0
    Last Post: July 14th, 11:43 PM
  5. Return to Tab
    By Joe Fallon in forum Microsoft Access
    Replies: 0
    Last Post: July 12th, 04:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139