将数据添加到相关的数据集表 [英] adding data to related dataset tables
问题描述
好的,我现在详细描述问题.
我有一个具有相关表的数据集,如下所示
< img src ="http://www.toyan.com.tr/download/image1.png"/>
"dt_bolumler"中的"ID"列是父表的主键,"bolumID"是子表的外键.
我尝试过的代码是:
mhs_sorubankasiDataSet.dt_sorular.Adddt_sorularRow(soru, sik1, sik2, sik3, sik4,bolumID,sayfaKitapNo,sik5);
"bolumID"是"int32"的类型.
当我尝试调试我的项目时,出现如下错误:
错误1``'' >
我的问题是:参数" Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow "是什么意思?
我从"dt_bolumler"表中获取ID,并将其以"int32"类型添加到"dt_sorular"表中,但是错误消息告诉我,我必须为"bolumID"添加数据类型"Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow".
如何以"Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow"的格式向子表添加"bolumID"?但我想您在数据库中有一个从子行到父行的反向引用.
例如,如果您的父母是UserInfo:
UserId, Name,您的孩子是一个MessageInfo:
MessageId, MessageText, UserId然后您需要UserID来创建MessageInfo.
感谢OriginalGriff
我只是在子表中使用一个名为bolumID的ID.我的问题在这里弹出. "dataset.addtableRow"方法告诉我,外键必须为父表行"类型.
问题中给出了代码.我今天改进了.
我在邮件中使用了图片,但无法在消息中正确查看它.您可以使用链接查看它.
再次感谢.
Ok I am now describing problem in details.
I have a dataset with related tables like below
<img src="http://www.toyan.com.tr/download/image1.png" />
"ID" column in "dt_bolumler" is the primary key of the parent table and "bolumID" is the foreign key of the child table.
the code that I tried is :
mhs_sorubankasiDataSet.dt_sorular.Adddt_sorularRow(soru, sik1, sik2, sik3, sik4,bolumID,sayfaKitapNo,sik5);
"bolumID" is the type of "int32".
when I try to debug my project a get an error like that:
Error 1 The best overloaded method match for ''Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_sorularDataTable.Adddt_sorularRow(string, string, string, string, string, Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow, string, string)'' has some invalid arguments
My question is that: what is the meaning of the argument "Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow"?
I get the ID from "dt_bolumler" table and add it to "dt_sorular" table in the type of "int32" however error message told me that I have to add a "Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow" type of data for "bolumID".
How can I add "bolumID" to child table in the format of "Muhsimder_Soru_bankasi.mhs_sorubankasiDataSet.dt_bolumlerRow"?
Without seeing your code, it is difficult to tell, but I am guessing that you have a back-reference from your child row to its parent in your database.
For example, if your parent was a UserInfo:
UserId, Nameand your child was a MessageInfo:
MessageId, MessageText, UserIdThen you need the UserID to create a MessageInfo.
thanks OriginalGriff
I am just using an ID called bolumID in child table. my question is popped up here. "dataset.addtableRow" method told me that foreign key must a type of "parent table row".
code is given into the question. I improved it today.
I use a pic in the message, but I am not able to view it in the messsage correctly. you can use the link to see it.
thanks again.
这篇关于将数据添加到相关的数据集表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!