Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 28th, 2005, 02:24 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Returning dataset to web application


Hi Everybody,
I m new in developing web service in vb.net. I have web service that returns dataset as results from database. When i call web service in window application it displays me result in the datagrid, but with the web application i m not been able to display the result from the web service.

What should i do??
Pls help me...

Cheers,
Nirav Patel.
Reply With Quote
  #2 (permalink)  
Old March 1st, 2005, 10:01 AM
Authorized User
 
Join Date: Nov 2004
Location: Indore, MP, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

Can you post the code ...

Reply With Quote
  #3 (permalink)  
Old March 2nd, 2005, 02:41 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is my code of web service whcih returns dataset from a database.
It displays well in the window applicaiton with datagrid but no idea y it is not displaying in web application. Code is remains same in both web application & window client.

Web Service Code

<WebMethod()> _
    Public Function GetTableData() As DataSet
        Dim dsn As String = "server=server;database=db;uid=user;pwd=passwo rd"
        Dim myConn As SqlClient.SqlConnection = New SqlClient.SqlConnection(dsn)
        'Open database connection
        myConn.Open()
        'Fetch data from database
        Dim myComm As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("select Name from BillTo where Bill_ID < 10", myConn)
        Dim ds As DataSet = New DataSet
        'Fill dataset with records
        myComm.Fill(ds, "Name")
        'Dim dataTable As New DataTable
        'dataTable = ds.Tables(1)
        'Close the connection
        myConn.Close()
        'Return dataset
        Return ds 'dataset
        ds = Nothing
    End Function

Window Application Client code works fine

Private Sub btnGetData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetData.Click
        Dim ds As New DataSet
        Dim service As New localhost.Service1
        ds = service.GetTableData()
        DataGrid1.DataSource = ds.Tables(0)
    End Sub

Web Application client code...Not working

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
         Dim ds As New DataSet
        Dim WService As New localhost.Service1
        Try
            ds = WService.GetTableData()
            DataGrid1.DataSource = ds.Tables(0)
        Catch ex As Exception
            Label1.Text = ex.Message
        End Try
End Sub

Plesase help..
Thanx in advance.

Cheers,
Nirav Patel.
Reply With Quote
  #4 (permalink)  
Old March 2nd, 2005, 03:25 AM
Authorized User
 
Join Date: Nov 2004
Location: Indore, MP, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

use databind at last
Try
            ds = WService.GetTableData()
            DataGrid1.DataSource = ds.Tables(0)
            DataGrid1.DataBind()
        Catch ex As Exception
            Label1.Text = ex.Message
        End Try



Reply With Quote
  #5 (permalink)  
Old March 13th, 2006, 05:43 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

        Return ds 'dataset
        ds = Nothing <- you may also want to put this at the top or something seeing as your function exits before this is executed
End Function



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Method Returning a complex Custom data type. saisunil1978 .NET Web Services 0 July 15th, 2008 06:38 AM
How to use global dataset for asp.net application swati_joshi ASP.NET 1.0 and 1.1 Basics 3 April 6th, 2007 10:30 PM
Returning resultset to ADO.NET dataset gp_mk Oracle 3 December 22nd, 2003 10:44 AM
Returning Oracle SELECT query results to DataSet gp_mk ADO.NET 0 December 17th, 2003 11:08 AM



All times are GMT -4. The time now is 03:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.