You must Sign In to post a response.
  • Category: Webservices

    Webservice method does not return a value

    Hi,
    In my web service method does not return values in the browser its shows the error
    in the browser like An Error occurred while processing output information.

    My webservice method as below:

    public string GetItemCategory(string strDate)
    {
    DataSet ds = new DataSet();
    string strDetails = "";
    if (ds.Tables[0].Rows.Count > 0)
    {
    strDetails += "[";
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    strDetails += "{\"Field1\":\"" + ds.Tables[0].Rows[i]["ID"].ToString() + "\", \"Field2\":\"" + ds.Tables[0].Rows[i]["CategoryName"].ToString() + "\",\"Field3\":\"" + ds.Tables[0].Rows[i]["Active"].ToString() + "\",\"Field4\":\"" + ds.Tables[0].Rows[i]["Categorycode"].ToString() + "\"},";
    }
    strDetails += "]";
    strDetails = strDetails.Replace(",]", "]");

    }
    return strDetails;

    }

    What's wrong in my webservice code i want to return the data from dataset to string.

    Could any body help me.

    Thank and Regards
    brite
  • #762150
    Hi

    In your code i tried from C# working Good

    try this code


    string ff = obj.GetItemCategory("Test");



    But you mention from browser did you call json Get?

    Can you share the code

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762158

    Hi Brite,

    The below code is first 3lines of your code part.


    DataSet ds = new DataSet();
    string strDetails = "";
    if (ds.Tables[0].Rows.Count > 0)


    In the above code where did you get data from database.

    In your case DataSet is null, but in your 3rd line you are checking table0 rows count.

    Hoe it is possible..?

    There is no tables in dataset then how you find table[0] and then rows of that.

    So, before that check the below condition too.

    if(ds.Tables.Count>0 && ds.Tables[0].Rows.Count>0)
    {
    //do your stuff here.
    }


    If you want to know the exact issue, put a breakpoint and check line by line.

    Hope this will helpful to you...


    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #762172
    Hi

    Are you filling the data set with data before performing operations on data set ds?

    Put break point and check till where you coding is carrying data.

    Directly check in wsdl file of webservice once by clicking the method you are calling.

    Regards

    Sridhar Thota.

    Sridhar Thota.
    Editor: DNS Forum.


Sign In to post your comments