Ask a Question related to ASP.NET Web Services, Design and Development.

  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. Similar Questions and Discussions

    1. Return me
      :confused; I need the html for Dreamweaver 8 that will return a person back to a previous page. They could be coming from any number of previous...
    2. return SQL ID
      one way (I believe to be the best way) is to use a stored procedure and set an output variable to the new SQL ID. a second way is to use a...
    3. goToNetPage, return or not return
      hi, I have read in the director's help the netDone() command indicates whether a background loading operation (such as getNetText,...
    4. How to return my own XML?
      When I create a web service, and create a web method that returns a string, the output is always framed within a tag that looks like: <string...
    5. Return Key
      This may sound like an odd question, but does anyone have a "return" key from a Wallstreet powerbook that they don't need? All i need is the key,...
  3. #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.diamond@NOSPAMthemedialounge.com> schreef in bericht
    news:uBYht9RKEHA.1340@TK2MSFTNGP12.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

  4. #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.diamond@NOSPAMthemedialounge.com> wrote in message
    news:uBYht9RKEHA.1340@TK2MSFTNGP12.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

  5. #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-mar@BADSPAMsnet.net> wrote in message
    news:eRGJaZVKEHA.2776@TK2MSFTNGP12.phx.gbl...
    > Have you looked at the various methods of a DataSet that express its
    > contents as XML (writeXML, getXML)?
    >
    >
    > "Poppy" <paul.diamond@NOSPAMthemedialounge.com> wrote in message
    > news:uBYht9RKEHA.1340@TK2MSFTNGP12.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

Posting Permissions

  • You may not post new threads
  • You may 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