|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unable to cast object of type 'System.Data.DataSet' to Typed DataSetI currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't know why I cannot perform this casting operation properly. First off, I've got my Typed DataSet named "AuthInfo" declared and I then created an instance of that class. What I'd like to do next is to perform querying through the method ExecuteDataSet() of Microsoft Data Access Library which will return me the untyped dataset. Here is the point, I would like to convert the return untyped DataSet into my Typed DataSet "AuthInfo" but I'm still getting this error "Unable to cast object of type 'System.Data.DataSet' to type 'AuthInfo'. ..." I've put my code snippet here as shown below. Dim doAuth as AuthInfo dst = db.ExecuteDataSet(dbCommand) doAuth = CType(dst, AuthInfo) I think I've seen someone do something like this before but I've got no idea what's wrong with my code. The generic dataset returned cannot be "Cast" because it doesn't inherit or
derived from your Typed Dataset. Look into the "Merge" method of the typed dataset to read-in data from the generic untyped dataset. If the tables and columns match it should pour the data into the appropriate corresponding places in your typed dataset. Show quoteHide quote "Optimus" <sarun***@gmail.com> wrote in message news:1138671817.339470.204330@o13g2000cwo.googlegroups.com... > Hi everyone, > > I currently develop an application in vs.net 2005 with vb.net. > I was trying to use typed dataset and I've got in trouble for > converting untyped dataset > into Typed DataSet. I don't know why I cannot perform this casting > operation properly. > First off, I've got my Typed DataSet named "AuthInfo" declared and I > then created an instance of that class. What I'd like to do next is to > perform querying through the method ExecuteDataSet() of Microsoft Data > Access Library which will return me the untyped dataset. Here is the > point, I would like to convert the return untyped DataSet into my Typed > DataSet "AuthInfo" but I'm still getting this error "Unable to cast > object of type 'System.Data.DataSet' to type 'AuthInfo'. ..." I've put > my code snippet here as shown below. > > Dim doAuth as AuthInfo > dst = db.ExecuteDataSet(dbCommand) > doAuth = CType(dst, AuthInfo) > > I think I've seen someone do something like this before but I've got no > idea what's wrong with my code. >
Application.Exit or End
VB2005 pro Graphics IsDate("ISomeTimesHateProgrammingMarch2005") = True Sending a message to another computer -how? Better way to go from ArrayList to Object() Convert from C# to VB.Net Simple (I hope) SteamReader DirectoryInfo question miplementing cut/copy/paste Getting AD Username Get distinct values from a column in a datatable |
|||||||||||||||||||||||