Click here to Skip to main content
15,036,363 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Session[StringConstants.DTRefTransactions] = dsRefTransactions.Tables[0];

getting error as unable to cast object of type '' to type '' on above line of code . how to type cast it?
Updated 8-Nov-11 3:04am
Can you read the error message?
Why do you think you want to cast it?

You cannot. A DataTable is not a DataSet.
durgeshtupkar10 8-Nov-11 9:10am
what solution then?
Enough said, a 5.
Abhinav S 8-Nov-11 11:24am
Thanks SA.
You can't cast a DataTable to a DataSet. It sounds like your code is expecting a DataSet so you could try:

Session[StringConstants.DTRefTransactions] = dsRefTransactions;
durgeshtupkar10 8-Nov-11 9:17am
but on following ur above suggestion it works but i want oth index datatable from that datasetparticular
jim lahey 8-Nov-11 9:19am
You've got the whole dataset in session. You can read it back out of session and do: dsRefTransactions.Tables[0]
No ifs no buts.
Sure, a 5. OP cannot apply simple logic.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900