Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataTable must be set prior to using DataView.
Message
De
03/09/2004 09:56:39
 
 
À
03/09/2004 07:06:35
Andrew Fell-Gordon
Calypso Publications Ltd
Enfield, Royaume Uni
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00939075
Message ID:
00939110
Vues:
13
Andrew,

Well, VB syntax sometimes throws me for a loop, but try setting up your View's Table when you first instantiate it, something like this:
Dim ExportFilesFinder As New DataView(ExportWorkingData.Tables("ExportFiles"))
Also, I noticed that you're setting two unnecessary properties ... unnecessary because you're setting them to the defaults anyway, so why bother:
.RowFilter = ""
.RowStateFilter = DataViewRowState.CurrentRows
Oh, I forgot to ask ... on which line are you getting the error?

~~Bonnie

>I am developing a winforms application and I am constructing a dataset to handle a complex set of working data required to control the update process.
>
>So I create a new dataset. Then I create table objects, add their columns and promary keys and then add them to the dataset's Tables collection. So far so good.
>
>I then need to create a dataview to interrogate one of the tables. I create the dataview object and set its table property to the table I want. When I try to set the dataview's sort property I get a data exception "DataTable must be set prior to using DataView."
>
>I thought this might be because I have no data in the data table so I added a dummy record to the table before I created the dataview. The relevant code looks like this
>
>
>.ExportFilesFinder = New DataView
>With .ExportFilesFinder
>   .Table = Me.ExportWorkingData.Tables("ExportFiles")
>   .RowFilter = ""
>   .RowStateFilter = DataViewRowState.CurrentRows
>   .Sort = "CommentaryPointId asc"
>End With
>
>
>I'm probably doing something basically wrong but help on this error message is hard to come by. Anyone got any thoughts or solutions?
>
>TIA
>
>Andrew
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform