Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem casting typed dataset
Message
From
15/07/2005 10:24:22
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01032714
Message ID:
01033043
Views:
19
Paul,

You could instantiate it as the Typed DataSet, but return a DataSet.
public DataSet GetPendingCharges()
{
   ccProcessLogDataSet dsPending = new ccProcessLogDataSet ();

   string sql = "SELECT * FROM " + this.TableName + " WHERE cCardType = 'PWCC'";
   // Stuff deleted
   dsPending = this.GetDataSet(sql);
   // More stuff deleted

   return dsPending;
}
~~Bonnie


>I have a solution file which is made up of multiple projects. One of the projects includes a typed dataset (named ccProcessLogDataSet, the table is named CCProcessLog). In a business object in this same project, I have a method that basically retrieves a dataset (via a SQL query). I'm returning a standard dataset. This code currently works.
>
>In another project in this same solution, I call this other class's method using code like this:
>
>
>Business.ccProcessLogDataSet dsPending = (Business.ccProcessLogDataSet) ccProcess.GetPendingCharges();
>
>
>The GetPendingCharges() method basically looks like this:
>
>
>public DataSet GetPendingCharges()
>{
>   DataSet dsPending = new DataSet();
>
>   string sql = "SELECT * FROM " + this.TableName + " WHERE cCardType = 'PWCC'";
>   // Stuff deleted
>   dsPending = this.GetDataSet(sql);
>   // More stuff deleted
>
>   return dsPending;
>}
>
>
>This compiles OK, but as soon as it reaches this line and attempts the cast, I get an invalid cast exception thrown.
>
>I'm not entirely sure why this isn't working; maybe it's staring me in the face, but I just not seeing it.
>
>Any ideas?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform