Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datatable casting issue

Status
Not open for further replies.

chris123321

IS-IT--Management
Joined
Mar 13, 2007
Messages
139
Location
US
Code:
dttestreport = directcast(gf.SelectDistinct(tdtReportInfo), dsReportData.ReportInfoDataTable
dttestreport, tdtReportInfo are all of typed ReportInfoDataTable. gf.SelectDistinct returns an untyped dataTable. So what I want to do is cast the untyped table as ReportInfoDataTable.

The error that is being returned is "Specified Cast Is Not Valid."

Any suggestions?
 
what would the work around be?
 
I'd say you would either create it as the correct type initially or, if you can't, loop through the rows and add them to a new instance of the correct object type.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top