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;
}
John Young - 25 Jun 2004 00:17 GMT
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
> Hi,
>
[quoted text clipped - 72 lines]
>
> }