Click here to Skip to main content
15,860,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
private Data.lehrlingDataSetTableAdapters.NV_AUFKTableAdapter AUFKAdapter = new Data.lehrlingDataSetTableAdapters.NV_AUFKTableAdapter();


- i filled the datatable on load:
C#
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

1 solution

Now you will go by this :
Suppose, you want only AUFK id numbers, the code is as below;
C#
foreach(DataRow dr in lehrlingDataSet.NV_AUFK)
{
   label1.Text=dr["id"].ToString();
}

This is just a sample, make changes according your requirements.. Good Luck :)
 
Share this answer
 
Comments
niko_tells 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900