all groups > dotnet web services > june 2004 >
You're in the

dotnet web services

group:

Webservice and DataSet problem.


Webservice and DataSet problem. John Young
6/24/2004 11:20:55 PM
dotnet web services:
Hi,

I have a strange problem with returning a dataset from a webservice. Here's
some code... The error I get at compile time is.
"Cannot convert type 'void' to 'System.Data.DataSet'"

Can anyone help me please. I have heard something about typed datasets,
would that make a difference?
Thanks in advance...

John Young

-------------------

Main form code...
private void button1_Click(object sender, System.EventArgs e)

{

CITWebservices.CITWS myWS = new Win_CIT.CITWebservices.CITWS();

DataSet ds = myWS.GetJobServicesList(); // ***** I GET A COMPILE ERROR HERE
*****

myWS.Dispose();

}





WebService code....

[WebMethod]

public DataSet GetJobServicesList()

{

// get a list of the job services available

DataSet ds = new DataSet();

CIT.BackendDB.DatabaseAccess dba = new CIT.BackendDB.DatabaseAccess();

ds = dba.GetJobServicesListFromDB();

return ds;

}





Data access code...

public DataSet GetJobServicesListFromDB()

{

// get the list of job services from the database and return to the
webservice

string sConnectionString = "user id=sa; Initial Catalog=CIT; Data
Source=localhost; Integrated Security=SSPI";

SqlConnection objConn = new SqlConnection(sConnectionString);

objConn.Open();

SqlDataAdapter jobServicesList = new SqlDataAdapter("SELECT Service FROM
tableLookupService", objConn);

DataSet ds = new DataSet();

jobServicesList.Fill(ds,"tableLookupService");

objConn.Close();

return ds;

}

Re: Webservice and DataSet problem. John Young
6/25/2004 12:17:03 AM
Right, I finally found a solution. It seems that it is some kind of bug.
Although it apparently happens on the beta version of VS.NET !! I have the
full version.. Strange...

Anyway, I found the solution here >
http://support.microsoft.com/default.aspx?scid=kb;EN-US;815131

Hope that helps anyone who may have the same problem as me

John


[quoted text, click to view]

AddThis Social Bookmark Button