由于并非所有值都有对应的父值,因此无法启用此约束.

编程入门 行业动态 更新时间:2024-10-25 22:26:24
本文介绍了由于并非所有值都有对应的父值,因此无法启用此约束.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我遇到以下错误 无法启用此约束,因为并非所有值都有对应的父值. 代码是: 试试 DB.connectDB() 将Dim ds用作新数据集 Dim dt1作为DataTable = DB.selectRecord("SELECT tbl_Profile_View.ContractorID,COUNT(tbl_Profile_View.ContractorID)AS Profiles_View,realtygu_dbo.vwUserspName LoginName,realtygu_dbo.vwUsers.CompanyAddress,realtygu_dbo.vwUsers.PhoneNo.内联接realtygu_dbo.vw用户打开tbl_Profile_View.ContractorID = realtygu_dbo.vwUserspID GROUP BY tbl_Profile_View.ContractorID,realtygu_dbo.vwUserspName,realtygu_dbo.vwUsers.CompanyAddress,realtygu_dbo.vwUserProfile. ) Dim dTable1 As DataTable = dt1.Copy dTable1.TableName =父母" ds.Tables.Add(dTable1) Dim dt2作为DataTable = DB.selectRecord("SELECT tbl_Profile_View.ContractorID,COUNT(tbl_Profile_View.ContractorID)AS Profiles_View,realtygu_dbo.vwUserspName作为LoginName,realtygu_dbo.vwUsers.CompanyAddress,realtygu_dbo.vwUsers.Phone来自tbl_Profile_View的tbl_Profile_View.ClientID内联接realtygu_dbo.vw用户打开tbl_Profile_View.ClientID = realtygu_dbo.vwUserspID GROUP BY tbl_Profile_View. tbl_Profile_View.ClientID按tbl_Profile_View.ClientID升序排列) dTable dTable2为DataTable = dt2.Copy dTable2.TableName ="Child" ds.Tables.Add(dTable2) ds.Relations.Add("PK",ds.Tables(0).Columns("ContractorID"),ds.Tables(1).Columns("ContractorID")) ''ds.Tables(0).DefaultView.Sort ="InvoiceDate Desc" ViewState("ds")= ds hgProvider.DataSource = ds hgProvider.DataMember = ds.Tables(0).TableName hgProvider.DataBind() 异常捕获 Response.Write(ex.Message) 结束尝试 解决方法请帮帮我 谢谢您

i am getting following error This constraint cannot be enabled as not all values have corresponding parent values. the code is : Try DB.connectDB() Dim ds As New DataSet Dim dt1 As DataTable = DB.selectRecord("SELECT tbl_Profile_View.ContractorID, COUNT(tbl_Profile_View.ContractorID) AS Profiles_View, realtygu_dbo.vwUserspName LoginName, realtygu_dbo.vwUsers.CompanyAddress, realtygu_dbo.vwUsers.PhoneNo, realtygu_dbo.vwUsers.CompanyEmail FROM tbl_Profile_View INNER JOIN realtygu_dbo.vwUsers ON tbl_Profile_View.ContractorID = realtygu_dbo.vwUserspID GROUP BY tbl_Profile_View.ContractorID, realtygu_dbo.vwUserspName, realtygu_dbo.vwUsers.CompanyAddress, realtygu_dbo.vwUsers.PhoneNo, realtygu_dbo.vwUsers.CompanyEmail order by tbl_Profile_View.ContractorID asc") Dim dTable1 As DataTable = dt1.Copy dTable1.TableName = "Parent" ds.Tables.Add(dTable1) Dim dt2 As DataTable = DB.selectRecord("SELECT tbl_Profile_View.ContractorID, COUNT(tbl_Profile_View.ContractorID) AS Profiles_View, realtygu_dbo.vwUserspName as LoginName, realtygu_dbo.vwUsers.CompanyAddress, realtygu_dbo.vwUsers.PhoneNo, realtygu_dbo.vwUsers.CompanyEmail, tbl_Profile_View.ClientID FROM tbl_Profile_View INNER JOIN realtygu_dbo.vwUsers ON tbl_Profile_View.ClientID = realtygu_dbo.vwUserspID GROUP BY tbl_Profile_View.ContractorID, realtygu_dbo.vwUserspName, realtygu_dbo.vwUsers.CompanyAddress, realtygu_dbo.vwUsers.PhoneNo, realtygu_dbo.vwUsers.CompanyEmail, tbl_Profile_View.ClientID order by tbl_Profile_View.ClientID asc ") Dim dTable2 As DataTable = dt2.Copy dTable2.TableName = "Child" ds.Tables.Add(dTable2) ds.Relations.Add("PK", ds.Tables(0).Columns("ContractorID"), ds.Tables(1).Columns("ContractorID")) ''ds.Tables(0).DefaultView.Sort = "InvoiceDate Desc" ViewState("ds") = ds hgProvider.DataSource = ds hgProvider.DataMember = ds.Tables(0).TableName hgProvider.DataBind() Catch ex As Exception Response.Write(ex.Message) End Try how it is solve please help me thanks you

推荐答案

您在此处创建了两个数据表(table1,table2). 并且在两个表中都有一些值,您可以从数据库中选择它们.. 您的表格中有一些数据会产生冲突..尝试消除两者之间的冲突.. 否则只需在代码中更改一行,然后尝试 You have created two data tables here(table1, table2). and in both table there is some values, which you are selecting from database.. In your table there is some data which is producing confliction.. Try to remove the conflict between both.. or else just change a line in your code and try ds.Relations.Add("FK", ds.Tables(0).Columns("ContractorID"), ds.Tables(1).Columns("ContractorID"))

最好的..:)

all the best.. :)

更多推荐

由于并非所有值都有对应的父值,因此无法启用此约束.

本文发布于:2023-10-25 21:48:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1528197.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:都有

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!