本文介绍了属性"Item"遮盖了在基类"DataRow"中声明的可重载成员.如果要重载基本方法,则必须将此方法声明为“重载".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
      Public Property Item() As String
           Get
               Return CType(Me(Me.tableSpDet.ItemColumn), String)
           End Get
           Set(ByVal value As String)
               Me(Me.tableSpDet.ItemColumn) = value
           End Set
       End Property



错误:(警告)
属性"Item"遮盖了在基类"DataRow"中声明的可重载成员.如果要重载基本方法,则必须将该方法声明为重载".


我创建了数据集"TransportDataSet.xsd".在这个designer.vb页面中,出现了上面几行类似的错误....................... ...................



ERROR:(WARNING)
property ''Item'' shadows an overloadable member declared in the base class ''DataRow''. If you want to overload the base method, this method must be declared ''Overloads''.


I created data set "TransportDataSet.xsd".In this designer.vb page, i got error like above lines..............................................

推荐答案

Partial Public Class SpDetRow
        Inherits Global.System.Data.DataRow



对于DataBase Field name的每个字段,都使用Property,如下所示:



with a Property for each field of the DataBase with the Field name as follows:

<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property Name() As String
   Get
       Return CType(Me(Me.tableSpDet.NameColumn), String)
   End Get
   Set(ByVal value As String)
       Me(Me.tableSpDet.NameColumn) = value
   End Set
End Property


同样,在上述情况下,它为field Item of the Database.
创建了Property Item
但是基类DataRow 具有属性Item ,如此处所述
http://msdn.microsoft.com/en-us/library/system. data.datarow.aspx#Y0 [ ^ ],因此可能会引发上述错误.

为避免该错误,请尝试将数据库中的字段名称从Item重命名为SpDetItem,然后再次从数据库中生成类型化的数据集,以便设计人员将为SpDetItem 生成属性,而不是Item.以上冲突可以解决.

我认为这可能会有所帮助.


Similarly in the above case it has created a Property Item for the field Item of the Database.

But the base class DataRow has a property Item as explained here
http://msdn.microsoft.com/en-us/library/system.data.datarow.aspx#Y0[^] hence the above error may be thrown.

To avoid that error try renaming the Field name in the DataBase from Item to say SpDetItem and generated the typed DataSet again from the DataBase, so that the designer will generate the Property for SpDetItem instead of Item, so that the above conflict can be resolved.

I think it may be helpful.


这篇关于属性"Item"遮盖了在基类"DataRow"中声明的可重载成员.如果要重载基本方法,则必须将此方法声明为“重载".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 02:55