Webservice and DataSet problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Young

    #1

    Webservice and DataSet problem.

    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.Da taSet'"

    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(o bject sender, System.EventArg s e)

    {

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

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

    myWS.Dispose();

    }





    WebService code....

    [WebMethod]

    public DataSet GetJobServicesL ist()

    {

    // get a list of the job services available

    DataSet ds = new DataSet();

    CIT.BackendDB.D atabaseAccess dba = new CIT.BackendDB.D atabaseAccess() ;

    ds = dba.GetJobServi cesListFromDB() ;

    return ds;

    }





    Data access code...

    public DataSet GetJobServicesL istFromDB()

    {

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

    string sConnectionStri ng = "user id=sa; Initial Catalog=CIT; Data
    Source=localhos t; Integrated Security=SSPI";

    SqlConnection objConn = new SqlConnection(s ConnectionStrin g);

    objConn.Open();

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

    DataSet ds = new DataSet();

    jobServicesList .Fill(ds,"table LookupService") ;

    objConn.Close() ;

    return ds;

    }


  • John Young

    #2
    Re: Webservice and DataSet problem.

    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 >


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

    John


    "John Young" <polomint77ATAT hotmail.com> wrote in message
    news:OWze6ljWEH A.2844@TK2MSFTN GP09.phx.gbl...[color=blue]
    > 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.Da taSet'"
    >
    > 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(o bject sender, System.EventArg s e)
    >
    > {
    >
    > CITWebservices. CITWS myWS = new Win_CIT.CITWebs ervices.CITWS() ;
    >
    > DataSet ds = myWS.GetJobServ icesList(); // ***** I GET A COMPILE ERROR
    > HERE *****
    >
    > myWS.Dispose();
    >
    > }
    >
    >
    >
    >
    >
    > WebService code....
    >
    > [WebMethod]
    >
    > public DataSet GetJobServicesL ist()
    >
    > {
    >
    > // get a list of the job services available
    >
    > DataSet ds = new DataSet();
    >
    > CIT.BackendDB.D atabaseAccess dba = new CIT.BackendDB.D atabaseAccess() ;
    >
    > ds = dba.GetJobServi cesListFromDB() ;
    >
    > return ds;
    >
    > }
    >
    >
    >
    >
    >
    > Data access code...
    >
    > public DataSet GetJobServicesL istFromDB()
    >
    > {
    >
    > // get the list of job services from the database and return to the
    > webservice
    >
    > string sConnectionStri ng = "user id=sa; Initial Catalog=CIT; Data
    > Source=localhos t; Integrated Security=SSPI";
    >
    > SqlConnection objConn = new SqlConnection(s ConnectionStrin g);
    >
    > objConn.Open();
    >
    > SqlDataAdapter jobServicesList = new SqlDataAdapter( "SELECT Service FROM
    > tableLookupServ ice", objConn);
    >
    > DataSet ds = new DataSet();
    >
    > jobServicesList .Fill(ds,"table LookupService") ;
    >
    > objConn.Close() ;
    >
    > return ds;
    >
    > }
    >
    >[/color]


    Comment

    Working...