Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# databse
hi
 
I have a database, with 5 tables, for my question i just need 2 to explain
my situation.
 
One is: AUFK
Second is: AUFP
 
In my form, AUFK is ment my adding a new ordernnumber(PK), the User who ordered and the date. This are Detailed View -> Textboxes and have the same bindingsource -> AUFK.
 
Now i have added into AUFK, the datatable AUFP, this is going by dataset. So i
get a datagridview from AUFP, from AUFK.
 
AUFP is just, if a User have already AUFK entries, it should display them, when you validate the AUFK Number Textbox in the form.
 
What i have done till now:
 
-creating the adapter for that table
 
private Data.lehrlingDataSetTableAdapters.NV_AUFKTableAdapter AUFKAdapter = new Data.lehrlingDataSetTableAdapters.NV_AUFKTableAdapter();
 
- i filled the datatable on load:
this.nV_AUFKTableAdapter.Fill(this.lehrlingDataSet.NV_AUFK);
 
- i set the proper settings in the datatabledesigner for the relations, but now i dont know how to use the datatableadapter right. If i validate the AUFK number box, if the number exists that it should fill my gridview AUFP.
 
Thank you for evtl. help!
 
Greets niko
Posted 2-Dec-12 23:26pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Now you will go by this :
Suppose, you want only AUFK id numbers, the code is as below;
foreach(DataRow dr in lehrlingDataSet.NV_AUFK)
{
   label1.Text=dr["id"].ToString();
}
This is just a sample, make changes according your requirements.. Good Luck Smile | :)
  Permalink  
Comments
niko_tells at 3-Dec-12 4:38am
   
i dont think that this gonna work, but nice idea! I need in the AUFK->AUFP table the whole row (if the number exists) from AUFP. AUFK has an "id" and AUFP has an "id", now if the textbox shows one that exists, the datatable(aufp) should fill the rest of informations that AUFP contains. But thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 249
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 197
4 Sinisa Hajnal 176
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100