Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to navigate to a record in a dataset
Message
De
09/07/2004 11:29:37
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
 
 
À
09/07/2004 08:36:47
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00921051
Message ID:
00922530
Vues:
12
Tony,

Are you saying you get an error when you run your code, because Rows doesn't exist in Me.dsAllReqs?

I've done little with VB.NET as of yet, but I think that you still need to reference the table in your dataset, no?
Dim rowFoundRow As DataRow = Me.dsAllReqs.Tables(YourTableName).Rows.Find(n)
I think you can do this without data relations, but as far as they go, all datatables that participating in the data relation must be in the same dataset. There are a couple ways to do that. We're running SQL stored procedures that, in one call, pull multiple datatables to the a single dataset.

Another way is to simply copy the datatable from one dataset to another. A caveat for that solution is that you'll probably need to account for sync-ing the two datatables when changes are made. That's why we opted for the first choice.

Hope that helps,
---J

>OK, I still have a problem here and I can't get my mind around it.
>
>I have the following code:
>
> Me.dsReqs = Me.oReqDetail.GetReqByReqIDSP(Me.txtReqNum.Text)
> Dim drView As DataRowView = Me.GetCurrentRow(Me.dsReqs, "ReqDetail")
>
>This gives me a view of all the fields, but I don't need all that information, or I can't find the information I need in the view.
>
>But what's next?
>
>Now I need to go to my other dataset with all my records in it and move to the same record in it. The following code doesn't work:
>
> Private Function FindRow(ByVal lnReqID)
> Dim n As String = CStr(lnReqID)
> Dim rowFoundRow As DataRow = Me.dsAllReqs.Rows.Find(n)
> If Not (rowFoundRow Is Nothing) Then
> MessageBox.Show(CType(rowFoundRow(1), String))
> Else
> MessageBox.Show("A row with the primary key of " & _
> n & " could not be found")
> End If
> End Function
>
> Because Rows is not a member of the dataset Me.dsAllReqs
>
>Perhaps I should really be setting a relation between dsReqs and dsAllReqs to that when I get to the record in dsReqs, it will automatically go to the same record in dsAllReqs.
>
>So can I do that in the framework. Can I set up a relation between the two datasets?
>
>Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform