Oops.  Hit that send a little too soon.

Don't see any obvious problems, but try closing your reader connection
before you create  the DataSet.

Here's an article on working with typed datasets over a web service that
could be helpful.  Discusses sharing the type properly between the client
and server assembly.

http://www.aspnetpro.com/NewsletterArticle/2004/02/asp200402nb_l/asp200402nb
_l.asp

HTH,

Dean Fiala
-----------------------------
Very Practical Software, Inc.
http://www.vpsw.com/links.aspx



-----Original Message-----
From: Doug Wilson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 25, 2004 8:33 AM
To: [EMAIL PROTECTED]
Subject: [AspNetAnyQuestionIsOk] How to return a typed dataset from a
web service






Bespoke Applications Development Team






  _____


Hi All



I have a DAL method that return a typed data set (dsProductCatalogue) from
the SQL database.



When this project is included in my server application, it works fine, but
when I call the same method from within my web service, it does not return
all records, even though the schema returned is correct, and the first
record from the first table is returned.



Can anyone tell me what I'm doing wrong?



DAL Method Signature:

public ProductCatalogueDAL.dsProductCatalogue CreateDataSet(string strConn,
int intDealerID)



WebService:



[WebMethod]

public ProductCatalogueDAL.dsProductCatalogue GetDataSet(string strUsername,
string strPassword)

{

      string strConn = ConfigurationSettings.AppSettings["conn"];

      SqlConnection conn = new SqlConnection(strConn);

      string sql = "SELECT ID FROM Dealerships WHERE Email = '" +

      Resin.DataHelper.antiInject(strUsername) + "' AND Password = '" +

      Resin.DataHelper.antiInject(strPassword) + "'";

      SqlCommand cmd = new SqlCommand(sql,conn);

      cmd.Connection.Open();

      SqlDataReader dr = cmd.ExecuteReader();

      if (dr.Read())

      {

            ProductCatalogueDAL.User usr = new ProductCatalogueDAL.User();

            usr.DealerID = Convert.ToInt32(dr["ID"]);

            ProductCatalogueDAL.ProdCatDataAccessor pcda = new
ProductCatalogueDAL.ProdCatDataAccessor();

            ProductCatalogueDAL.dsProductCatalogue ds = new
ProductCatalogueDAL.dsProductCatalogue();

            ds =
pcda.CreateDataSet("Server=127.0.0.1;uid=sa;pwd=;Database=AW_ProdCats",
usr.DealerID);

            return ds;

      }

      cmd.Connection.Close();

      return null;

}






  _____


Doug Wilson | Lead Applications Developer | iX Webhouse


iX Headoffice | Umhlanga , South Africa | Mobile: +2783 6412944


Tel: +2731 5669250 | Fax: +2731 5669260 | Email: [EMAIL PROTECTED]








[Non-text portions of this message have been removed]





Yahoo! Groups Links









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to