chump2877
09-25-2007, 05:48 PM
The problem: I have a WebMethod that is returning (or supposed to return) a DataSet to my consuming application. But I'm getting a wierd compile error.
The web service (StudentTableService.asmx):
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Tric.StudentRegistration.DataAccess;
namespace StudentRegistrationServices
{
/// <summary>
/// Summary description for StudentTableService
/// </summary>
[WebService(Namespace = "http://StudentTableService.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class StudentTableService : System.Web.Services.WebService
{
[WebMethod]
public DataSet GetStudents()
{
TableDataAccess tda = new TableDataAccess();
DataTable dataTable = tda.GetStudents();
return dataTable.DataSet;
}
[WebMethod]
public void UpdateStudents(DataSet dataSet)
{
TableDataAccess tda = new TableDataAccess();
tda.UpdateStudents(dataSet.Tables["Student"]);
}
}
}
The relevant consumer app code:
private void RenderGridView()
{
StudentRegistrationServices.StudentTableService webService = new StudentRegistrationServices.StudentTableService();
DataSet dataSet = webService.GetStudents();
DataTable studentDataTable = dataSet.Tables["Student"];
DataView dataView = SortDataTable(studentDataTable);
// Bind the sorted DataView object to the GridView
GridView1.DataSource = dataView;
GridView1.DataBind();
Session["DataTable"] = studentDataTable;
}
This line of code in the consuming app:
DataSet dataSet = webService.GetStudents();
...produces the following error:
Error 1 Cannot implicitly convert type 'StudentWeb.StudentRegistrationServices.GetStudentsResponseGetStudentsResult' to 'System.Data.DataSet'
This is the ONLY compile error that I am receiving.
I have been stuck on this for days. :(
Help is appreciated. Thanks.
The web service (StudentTableService.asmx):
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using Tric.StudentRegistration.DataAccess;
namespace StudentRegistrationServices
{
/// <summary>
/// Summary description for StudentTableService
/// </summary>
[WebService(Namespace = "http://StudentTableService.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class StudentTableService : System.Web.Services.WebService
{
[WebMethod]
public DataSet GetStudents()
{
TableDataAccess tda = new TableDataAccess();
DataTable dataTable = tda.GetStudents();
return dataTable.DataSet;
}
[WebMethod]
public void UpdateStudents(DataSet dataSet)
{
TableDataAccess tda = new TableDataAccess();
tda.UpdateStudents(dataSet.Tables["Student"]);
}
}
}
The relevant consumer app code:
private void RenderGridView()
{
StudentRegistrationServices.StudentTableService webService = new StudentRegistrationServices.StudentTableService();
DataSet dataSet = webService.GetStudents();
DataTable studentDataTable = dataSet.Tables["Student"];
DataView dataView = SortDataTable(studentDataTable);
// Bind the sorted DataView object to the GridView
GridView1.DataSource = dataView;
GridView1.DataBind();
Session["DataTable"] = studentDataTable;
}
This line of code in the consuming app:
DataSet dataSet = webService.GetStudents();
...produces the following error:
Error 1 Cannot implicitly convert type 'StudentWeb.StudentRegistrationServices.GetStudentsResponseGetStudentsResult' to 'System.Data.DataSet'
This is the ONLY compile error that I am receiving.
I have been stuck on this for days. :(
Help is appreciated. Thanks.