当我点击以下代码行时出现此错误
Me.Adapter.Fill(dataTable)
错误是
"列' SubscriberID,PublisherID'被限制为独特的。价值' NAV,PATN'已经存在。"
这是完整的代码
Public Overridable Overloads Function GetData() As MYDAL.MYDataTable
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Dim dataTable As MYDAL.MYTable = New MYDAL.MYDataTable()
Try
Me.Adapter.Fill(dataTable)
Catch ex As Exception
End Try
Return dataTable
End Function
我不明白上述错误的来源。我检查了数据库中的表,它有多行具有NAV,PATN值。但是在表格上的那两列上没有物理约束。
.net代码中没有约束..不是我发现的所以我不知道以下错误来自哪里。或者我怎么能进一步调试?
"列' SubscriberID,PublisherID'被限制为独特的。价值' NAV,PATN'已经存在。"
这是它尝试执行的select语句
SELECT SC.ActiveFlag
, SC.SubscriberID
, SC.PublisherID
, SC.PublicationGroupID
, SC.ArticleID
, SC.TerminateFlag
, SC.CirculationDaysBeforeArchive
, SC.CirculationRetentionDays
, SC.LastRetentionDate
, SC.LastArchiveDate
, SC.LastRetentionDate
, SC.LastArchiveDate
, S.SubscriberName
FROM dbo.Subscription SC
JOIN dbo.Subscriber S ON SC.SubscriberID = S.SubscriberID
ORDER BY S.SubscriberName
以下是此表中数据表中的所有约束
名称所有者类型Created_datetime
订阅dbo用户表2007-09-14 23:38:56.513
Column_name类型计算长度Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation
ActiveFlag typYesNo no 1 no(n / a)(n / a)NULL SubscriberID typSubscriberID no 4 no no no SQL_Latin1_General_CP1_CI_AS PublisherID typPublisherID no 4 no no no SQL_Latin1_General_CP1_CI_AS PublicationGroupID typPublicationGrpID no 6 no no no SQL_Latin1_General_CP1_CI_AS CirculationRetentionDays smallint no 2 5 0 no(n / a)(n / a)NULL ArticleID typArticleID no 6 no no no SQL_Latin1_General_CP1_CI_AS TerminateFlag typYesN no 1 no(n / a)(n / a)NULL CirculationDaysBeforeArchive smallint no 2 5 0 no(n / a)(n / a)NULL LastRetentionDate datetime no 8 yes(n / a)(n / a)NULL LastArchiveDate datetime no 8 yes(n / a)(n / a)NULL
身份种子增量不适用于复制
未定义任何标识列。 NULL NULL NULL
没有定义rowguidcol列。
PRIMARY
index_name index_description index_keys
fkPubArticleID nonclustered位于PRIMARY PublisherID,PublicationGroupID,ArticleID上 fkSubscriptionID非聚集位于PRIMARY SubscriberID上 位于PRIMARY SubscriberID,PublisherID,PublicationGroupID,ArticleID上的pkSubscription集群唯一主键
constraint_type constraint_name delete_action update_action status_enabled status_for_replication constraint_keys
列ActiveFlag DefOne130(n / a)(n / a)(n / a)(1)上的默认值 PRIMARY KEY(集群)pkSubscription(n / a)(n / a)(n / a)(n / a)SubscriberID,PublisherID,PublicationGroupID,ArticleID FOREIGN KEY Publication_Subscription No Action No Action Enabled Is_For_Replication PublisherID,PublicationGroupID,ArticleID 参考DataDistribution_DEV.dbo.Publication(PublisherID,PublicationGroupID,ArticleID) FOREIGN KEY Subscriber_Subscription无操作无操作已启用Is_For_Replication SubscriberID 参考DataDistribution_DEV.dbo.Subscriber(SubscriberID)
DataDistribution_DEV.dbo.Circulation:Subscription_Circulation DataDistribution_DEV.dbo.CirculationStatusChange:Subscription_CircStatusChange DataDistribution_DEV.dbo.TaskSubscription:Subscription_NotifSubscription
没有使用架构绑定参考表的视图'订阅'。