Web Service Not Returning Data

Discussion in 'ASP.NET WebServices' started by lairpr, Apr 14, 2008.

  1. Hi,

    Data from DataTable not showing.

    I am currently working on a web service that needs to update information from employees in active directory.
    I got a DataSet with two DataTables that returns data from a database. The bellow code is the one I am trying:



    [WebMethod(Description = "Get Employee Information From DB1")]


    public ServiceDS.EmployeeDataTable GetEmps() {


    ServiceDS.EmployeeDataTable empTA = new ServiceDS.EmployeeDataTable();


    return empTA;
    ServiceDS is the name for the DataSet.

    I still have not implemented any code for connecting to ADSI, I am trying to get this simple data to display.


    Forgot to mention I am new to web service, so any help will be very appreciated.

    Thanks.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    based on your code, you are returning an empty dataset. You should not expect anything unti you fill the data set.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Hello, I'm new in to web service. I hope some one can help me. I create a web service but in browser it cannot return the anydata from database (http://localhost/website/service.asmx), but from debug.NET, it can return any data from database. (http://localhost:1057/website/service.asmx). Canyou explain to mewhat I need so the web service can run on localhost (may be setting on IIS or I must start any services)? (If needed, I use windows XP professional, Microsoft visual studio 2005).</o:p>
    </o:p>
    Note : if to registry the component asp .net, I already register it using this command aspnet_regiis -i</o:p>
    </o:p>
    Thanks.</o:p>
    </o:p>
    </o:p>
    Here the code:</o:p>
    Public Class Service</o:p>
    Inherits System.Web.Services.WebService</o:p>
    Public strconn As SqlConnection = New SqlConnection("server=local;database=northwind; uid =sa")</o:p>
    Public sda As New SqlDataAdapter</o:p>
    Public objData As New DataSet</o:p>
    <WebMethod()> _</o:p>
    Public Function selectRows(ByVal queryString As String) As DataSet</o:p>
    Try</o:p>
    strconn.Open()</o:p>
    sda.SelectCommand = New SqlCommand(queryString, strconn)</o:p>
    sda.Fill(objData)</o:p>
    strconn.Close()</o:p>
    Catch ex As Exception</o:p>
    strconn.Close()</o:p>
    End Try</o:p>
    Return objData</o:p>
    End Function</o:p>
     

Share This Page