C#使用TableAdapter [英] C# working with TableAdapter

查看:192
本文介绍了C#使用TableAdapter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


我有一个数据库,有5个表,对于我的问题,我只需要2来解释

我的情况。



一个是:AUFK

第二个是:AUFP



在我的表格中,AUFK是我添加了一个新的ordernnumber(PK),订购的用户和日期。这是详细视图 - >文本框并具有相同的bindingsource - > AUFK。



现在我已添加到AUFK,即数据表AUFP,这是按数据集进行的。所以我从AUFK获得来自AUFP的数据网格视图。



AUFP只是,如果用户已经有AUFK条目,它应该显示它们,当你在表格中验证AUFK号码文本框时。



到目前为止我做了什么:



-为该表创建适配器



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);





- 我在datatabledesigner中设置了适当的设置关系,但现在我不知道如何正确使用datatableadapter。如果我验证AUFK号码框,如果存在它应该填写我的gridview AUFP的数字。



谢谢你的evtl。帮助!



Greets niko



- 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

推荐答案

现在你将这样做:

假设您只需要AUFK ID号,代码如下;

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 :)


这篇关于C#使用TableAdapter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆