Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataSet w/ Multiple Tables
Message
De
29/04/2004 09:55:18
 
 
À
29/04/2004 09:19:19
Mindy Shingara
Central Susquehanna Intermediate Unit
Lewisburg, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Divers
Thread ID:
00899300
Message ID:
00899314
Vues:
14
Mindy,

What I'm confused about is your statement that:

"I want to add a new row to my dataset ("dsDetail"), but the only way I've seen to do this is by adding a row to a datatable.So, I've created a datatable ("dtDetail") based on the dataset ("dsDetail") and added a new row to it ("dr"). "

All DataSets contain DataTables. Your dsDetail DataSet has a table in it already. If you didn't name it when you filled it
da.Fill(dsDetail, "MyTable")
, then you can reference it simply as
dsDetail.Tables[0]
Or, have I misunderstood you somehow?

~~Bonnie


>Hi,
>I am working on a web form with a fox pro back end.....
>
>PROBLEM: Trying to add a new row of data to a dataset that contains fields from 2 tables.
>
>I have a dataset ("dsDetail") that is populated by a table ("bp_rqac") which has an outer join on another table ("bp_bidod"). I want to add a new row to my dataset ("dsDetail"), but the only way I've seen to do this is by adding a row to a datatable. So, I've created a datatable ("dtDetail") based on the dataset ("dsDetail") and added a new row to it ("dr"). The following code works fine to begin updating the fields from table("bp_rqac") in that new row ("dr")....
> dr["ra_reqnr"] = this.txtrq_reqnr.Text;
> dr["ra_maj"] = this.txtma_maj.Text;
> dr["ra_acct"] = this.txtra_acct.Text;
>
>However, when I try to use this code to update the fields from table ("bp_bidod") in the same datarow ("dr"), my form blows up.....
> dr["bo_bldg"] = Session["bldg"];
> dr["bo_reqnr"] = Session["reqnr"];
> dr["bo_maj"] = Session["major"];
> dr["bo_smaj"] = Session["subMajor"];
> dr["bo_min"] = this.txtic_min.Text;
>
>I get a message saying that the fields above with the prefix "bo" do not belong to table ("bp_rqac") which is correct; they belong to table ("bp_bidod"). But, there are fields from table ("bp_bidod") in the dataset ("dsDetail") from that outer join. How do I add this new row to the dataset and still have access to the fields from both tables? Do I need to create a DataRelation between the two tables? If so, could someone give me some direction on doing so?
>
>Thanks.
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