Newbie Question: fill a dataset with results from web service call

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

  1. #1

    Default Newbie Question: fill a dataset with results from web service call

    I am trying to get a better grasp of using web services. I have had
    success when I have a user type something into a text box and then
    pass that text to call an external web service on another server.
    This has worked for me when the result was only a single word such as
    "true" or "false". Now, I would like to make a call to a service that
    returns either rows of data or more than one word, such as a stock
    symbol returning the price, high, low, estimates, rating, etc. How
    would I make the call to the external web service and then assign the
    results to a Dataset? I want to use this dataset as the datasource
    for a Data Grid to display on the screen. Or perhaps there is an
    easier way to do this?
    Todd Guest

  2. Similar Questions and Discussions

    1. Newbie Question - Datagrid Results
      Is there a way to display the field you are GROUPING BY in a datagrid? I am doing a select count and using the GROUP BY option to display the...
    2. Color Fill Problem (Newbie Question)
      I drew a very simple shape (a house) with the pencil tool in Illustrator CS (Windows XP). First I drew the roof of a house (with an orange fill)and...
    3. web service newbie dataset question
      Could someone please tell me whether the following is possible? I'm especially murky about step #5 :-) I'd be very grateful for pointers to an...
    4. Newbie question - how to call one swf file from another at end
      I see plenty of examples of how to do this on a button press, and I'm sure this is even more simple, but I'm so green I can't see it yet. I've...
    5. updating a typed dataset (newbie question?)
      I created a DataGrid and bound a DataView of a typed DataSet to it (i tried with the DataSet as well but i'd rather use the DataView as i'm using it...
  3. #2

    Default Re: Newbie Question: fill a dataset with results from web service call

    The "easier" way to do this is to just avoid the webservice piece and call
    the database code directly.
    For a webservice, it should be as simple as making your WebMethod() return a
    Dataset type.

    VB.Net Example

    <WebMethod()> Public Function GetListOfSomething(ByVal sParamBlah As String)
    As DataSet

    Dim myDataSet as New DataSet()

    'Insert Code here to connect to database and populate a myDataSet

    Return myDataset
    End Function

    Michael
    "Todd" <bacile99@yahoo.com> wrote in message
    news:eb84a9d1.0401081429.408f03a6@posting.google.c om...
    > I am trying to get a better grasp of using web services. I have had
    > success when I have a user type something into a text box and then
    > pass that text to call an external web service on another server.
    > This has worked for me when the result was only a single word such as
    > "true" or "false". Now, I would like to make a call to a service that
    > returns either rows of data or more than one word, such as a stock
    > symbol returning the price, high, low, estimates, rating, etc. How
    > would I make the call to the external web service and then assign the
    > results to a Dataset? I want to use this dataset as the datasource
    > for a Data Grid to display on the screen. Or perhaps there is an
    > easier way to do this?

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004


    Michael Pearson Guest

  4. #3

    Default Re: Newbie Question: fill a dataset with results from web service call

    Thanks Michael. I understand what you are talking about as I have
    used the Command object several times to use a sql call or stored
    procedure call to populate a Dataset and display the information in a
    DataList or DataGrid. However, the purpose of calling the web service
    is to access data that I can't get from my database. For example, if
    I want to enter a stock symbol into a text box and press a submit
    button, I can't pass that sysmbol to a table on my database because I
    am not housing current data for stock prices. But there are several
    external web services that will do this. I just need to know the
    VB.Net syntax "from A to Z" on how I would return the web service
    result set into a dataset to bind to a datagrid. I have added my Web
    Reference for the stock price web service to my project, and I am
    passing the symbol to the service. I just need help on how I would be
    able to return the results to a DataGrid to display to the user.

    I have had success using an e-mail validator with this syntax:
    dim proxyEmail as new [Project
    Name].refernce.path.to.external.web.service
    Label.Text = proxyEmail.[webservice_name](textbox1.text)

    this returns either "true" or "false" to a label that is displayed to
    the user. Now if I want to return more data from a more complicated
    web service and bind that to a Datagrid to display to a user how would
    I do that? Do I use a Dataset control? An XMLDataDocument? Something
    else? Syntax examples would be appreciated. Thanks!

    "Michael Pearson" <michaelp_extrajunktoremove@televox.com> wrote in message news:<ui9V23j1DHA.2408@tk2msftngp13.phx.gbl>...
    > The "easier" way to do this is to just avoid the webservice piece and call
    > the database code directly.
    > For a webservice, it should be as simple as making your WebMethod() return a
    > Dataset type.
    >
    > VB.Net Example
    >
    > <WebMethod()> Public Function GetListOfSomething(ByVal sParamBlah As String)
    > As DataSet
    >
    > Dim myDataSet as New DataSet()
    >
    > 'Insert Code here to connect to database and populate a myDataSet
    >
    > Return myDataset
    > End Function
    >
    > Michael
    Todd Guest

  5. #4

    Default Re: Newbie Question: fill a dataset with results from web service call

    have you looked at the DataSet.Merge() method ?
    Maybe you get ds1 from webservice1, then get ds2 from webservice2, then
    merge them, then display?
    -D

    "Todd" <bacile99@yahoo.com> wrote in message
    news:eb84a9d1.0401090504.348210a7@posting.google.c om...
    > Thanks Michael. I understand what you are talking about as I have
    > used the Command object several times to use a sql call or stored
    > procedure call to populate a Dataset and display the information in a
    > DataList or DataGrid. However, the purpose of calling the web service
    > is to access data that I can't get from my database. For example, if
    > I want to enter a stock symbol into a text box and press a submit
    > button, I can't pass that sysmbol to a table on my database because I
    > am not housing current data for stock prices. But there are several
    > external web services that will do this. I just need to know the
    > VB.Net syntax "from A to Z" on how I would return the web service
    > result set into a dataset to bind to a datagrid. I have added my Web
    > Reference for the stock price web service to my project, and I am
    > passing the symbol to the service. I just need help on how I would be
    > able to return the results to a DataGrid to display to the user.
    >
    > I have had success using an e-mail validator with this syntax:
    > dim proxyEmail as new [Project
    > Name].refernce.path.to.external.web.service
    > Label.Text = proxyEmail.[webservice_name](textbox1.text)
    >
    > this returns either "true" or "false" to a label that is displayed to
    > the user. Now if I want to return more data from a more complicated
    > web service and bind that to a Datagrid to display to a user how would
    > I do that? Do I use a Dataset control? An XMLDataDocument? Something
    > else? Syntax examples would be appreciated. Thanks!
    >
    > "Michael Pearson" <michaelp_extrajunktoremove@televox.com> wrote in
    message news:<ui9V23j1DHA.2408@tk2msftngp13.phx.gbl>...
    > > The "easier" way to do this is to just avoid the webservice piece and
    call
    > > the database code directly.
    > > For a webservice, it should be as simple as making your WebMethod()
    return a
    > > Dataset type.
    > >
    > > VB.Net Example
    > >
    > > <WebMethod()> Public Function GetListOfSomething(ByVal sParamBlah As
    String)
    > > As DataSet
    > >
    > > Dim myDataSet as New DataSet()
    > >
    > > 'Insert Code here to connect to database and populate a myDataSet
    > >
    > > Return myDataset
    > > End Function
    > >
    > > Michael

    Dino Chiesa [Microsoft] Guest

  6. #5

    Default Re: Newbie Question: fill a dataset with results from web service call

    Oh, I see. You are getting like some Text or Array types back, and you want
    to "build your own" dataset.

    Take a look at this site:
    [url]http://www.informit.com/isapi/product_id~%7B6A3BC7D8-47B7-4C4B-BBDF-5B20CBC985F6%7D/content/index.asp[/url]

    I used that to build this small sample

    Dim oDataSet As New DataSet()

    Dim oTable As New DataTable()

    Dim oRow As DataRow

    Dim oStock(1) As Object

    oTable.Columns.Add("StockSymbol", GetType(String))

    oTable.Columns.Add("StockPrice", GetType(String))



    oStock(0) = "BLAH"

    oStock(1) = "$3.50"

    oTable.Rows.Add(oStock)

    oStock(0) = "BLAH2"

    oStock(1) = "$6.00"

    oTable.Rows.Add(oStock)



    oDataSet.Tables.Add(oTable)

    Michael



    "Todd" <bacile99@yahoo.com> wrote in message
    news:eb84a9d1.0401090504.348210a7@posting.google.c om...
    > Thanks Michael. I understand what you are talking about as I have
    > used the Command object several times to use a sql call or stored
    > procedure call to populate a Dataset and display the information in a
    > DataList or DataGrid. However, the purpose of calling the web service
    > is to access data that I can't get from my database. For example, if
    > I want to enter a stock symbol into a text box and press a submit
    > button, I can't pass that sysmbol to a table on my database because I
    > am not housing current data for stock prices. But there are several
    > external web services that will do this. I just need to know the
    > VB.Net syntax "from A to Z" on how I would return the web service
    > result set into a dataset to bind to a datagrid. I have added my Web
    > Reference for the stock price web service to my project, and I am
    > passing the symbol to the service. I just need help on how I would be
    > able to return the results to a DataGrid to display to the user.
    >
    > I have had success using an e-mail validator with this syntax:
    > dim proxyEmail as new [Project
    > Name].refernce.path.to.external.web.service
    > Label.Text = proxyEmail.[webservice_name](textbox1.text)
    >
    > this returns either "true" or "false" to a label that is displayed to
    > the user. Now if I want to return more data from a more complicated
    > web service and bind that to a Datagrid to display to a user how would
    > I do that? Do I use a Dataset control? An XMLDataDocument? Something
    > else? Syntax examples would be appreciated. Thanks!
    >
    > "Michael Pearson" <michaelp_extrajunktoremove@televox.com> wrote in
    message news:<ui9V23j1DHA.2408@tk2msftngp13.phx.gbl>...
    > > The "easier" way to do this is to just avoid the webservice piece and
    call
    > > the database code directly.
    > > For a webservice, it should be as simple as making your WebMethod()
    return a
    > > Dataset type.
    > >
    > > VB.Net Example
    > >
    > > <WebMethod()> Public Function GetListOfSomething(ByVal sParamBlah As
    String)
    > > As DataSet
    > >
    > > Dim myDataSet as New DataSet()
    > >
    > > 'Insert Code here to connect to database and populate a myDataSet
    > >
    > > Return myDataset
    > > End Function
    > >
    > > Michael

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.559 / Virus Database: 351 - Release Date: 1/7/2004


    Michael Pearson 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