Click here to Skip to main content
11,496,146 members (1,377 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
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

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 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 208
3 Sascha Lefèvre 195
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2015
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