Compile error in autogenerated dataset module (.xsd)

G

Gilbert Tordeur

Environment : Visual Studio 2003 v 7.1.3088 (French)
Development of a Windows application with SQL Server 2000

I get the following compile error message in the .xsd module : C:\Documents
and Settings\TORDEUR.FRYORKF\Mes documents\Visual Studio
Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly Property Site()
As SiteDataTable' et 'Public Overrides Property Site() As
System.ComponentModel.ISite' ne peuvent pas se surcharger mutuellement, car
seul 'ReadOnly' ou 'WriteOnly' les différencie. 'Shadows' est pris en compte
par défaut.

Translation : C:\Documents and Settings\TORDEUR.FRYORKF\Mes documents\Visual
Studio Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly Property
Site() As SiteDataTable' and 'Public Overrides Property Site() As
System.ComponentModel.ISite' cannot override each other, because only the
return types are different. 'Shadows' is taken into account by default.

What does that mean ? What can I do ? I have not this problem with other
tables, only when I call this one. I have deleted everything and set it
again : the error comes again. Thank you for your help.

..xsd source follows :

'---------------------------------------------------------------------------
---

' <autogenerated>

' This code was generated by a tool.

' Runtime Version: 1.1.4322.573

'

' Changes to this file may cause incorrect behavior and will be lost if

' the code is regenerated.

' </autogenerated>

'---------------------------------------------------------------------------
---

Option Strict Off

Option Explicit On

Imports System

Imports System.Data

Imports System.Runtime.Serialization

Imports System.Xml



<Serializable(), _

System.ComponentModel.DesignerCategoryAttribute("code"), _

System.Diagnostics.DebuggerStepThrough(), _

System.ComponentModel.ToolboxItem(true)> _

Public Class ClasseDsGeneral

Inherits DataSet


Private tableSociete As SocieteDataTable


Private tableAnnuaire As AnnuaireDataTable


Private tablePays As PaysDataTable


Private tableSection As SectionDataTable


Private tableSite As SiteDataTable


Public Sub New()

MyBase.New

Me.InitClass

Dim schemaChangedHandler As
System.ComponentModel.CollectionChangeEventHandler = AddressOf
Me.SchemaChanged

AddHandler Me.Tables.CollectionChanged, schemaChangedHandler

AddHandler Me.Relations.CollectionChanged, schemaChangedHandler

End Sub


Protected Sub New(ByVal info As SerializationInfo, ByVal context As
StreamingContext)

MyBase.New

Dim strSchema As String = CType(info.GetValue("XmlSchema",
GetType(System.String)),String)

If (Not (strSchema) Is Nothing) Then

Dim ds As DataSet = New DataSet

ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema)))

If (Not (ds.Tables("Societe")) Is Nothing) Then

Me.Tables.Add(New SocieteDataTable(ds.Tables("Societe")))

End If

If (Not (ds.Tables("Annuaire")) Is Nothing) Then

Me.Tables.Add(New AnnuaireDataTable(ds.Tables("Annuaire")))

End If

If (Not (ds.Tables("Pays")) Is Nothing) Then

Me.Tables.Add(New PaysDataTable(ds.Tables("Pays")))

End If

If (Not (ds.Tables("Section")) Is Nothing) Then

Me.Tables.Add(New SectionDataTable(ds.Tables("Section")))

End If

If (Not (ds.Tables("Site")) Is Nothing) Then

Me.Tables.Add(New SiteDataTable(ds.Tables("Site")))

End If

Me.DataSetName = ds.DataSetName

Me.Prefix = ds.Prefix

Me.Namespace = ds.Namespace

Me.Locale = ds.Locale

Me.CaseSensitive = ds.CaseSensitive

Me.EnforceConstraints = ds.EnforceConstraints

Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)

Me.InitVars

Else

Me.InitClass

End If

Me.GetSerializationData(info, context)

Dim schemaChangedHandler As
System.ComponentModel.CollectionChangeEventHandler = AddressOf
Me.SchemaChanged

AddHandler Me.Tables.CollectionChanged, schemaChangedHandler

AddHandler Me.Relations.CollectionChanged, schemaChangedHandler

End Sub


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.esignerSerializationVisibility.Content)> _

Public ReadOnly Property Societe As SocieteDataTable

Get

Return Me.tableSociete

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.esignerSerializationVisibility.Content)> _

Public ReadOnly Property Annuaire As AnnuaireDataTable

Get

Return Me.tableAnnuaire

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.esignerSerializationVisibility.Content)> _

Public ReadOnly Property Pays As PaysDataTable

Get

Return Me.tablePays

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.esignerSerializationVisibility.Content)> _

Public ReadOnly Property Section As SectionDataTable

Get

Return Me.tableSection

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.esignerSerializationVisibility.Content)> _

Public ReadOnly Property Site As SiteDataTable

Get

Return Me.tableSite

End Get

End Property


Public Overrides Function Clone() As DataSet

Dim cln As ClasseDsGeneral = CType(MyBase.Clone,ClasseDsGeneral)

cln.InitVars

Return cln

End Function


Protected Overrides Function ShouldSerializeTables() As Boolean

Return false

End Function


Protected Overrides Function ShouldSerializeRelations() As Boolean

Return false

End Function


Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader)

Me.Reset

Dim ds As DataSet = New DataSet

ds.ReadXml(reader)

If (Not (ds.Tables("Societe")) Is Nothing) Then

Me.Tables.Add(New SocieteDataTable(ds.Tables("Societe")))

End If

If (Not (ds.Tables("Annuaire")) Is Nothing) Then

Me.Tables.Add(New AnnuaireDataTable(ds.Tables("Annuaire")))

End If

If (Not (ds.Tables("Pays")) Is Nothing) Then

Me.Tables.Add(New PaysDataTable(ds.Tables("Pays")))

End If

If (Not (ds.Tables("Section")) Is Nothing) Then

Me.Tables.Add(New SectionDataTable(ds.Tables("Section")))

End If

If (Not (ds.Tables("Site")) Is Nothing) Then

Me.Tables.Add(New SiteDataTable(ds.Tables("Site")))

End If

Me.DataSetName = ds.DataSetName

Me.Prefix = ds.Prefix

Me.Namespace = ds.Namespace

Me.Locale = ds.Locale

Me.CaseSensitive = ds.CaseSensitive

Me.EnforceConstraints = ds.EnforceConstraints

Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)

Me.InitVars

End Sub


Protected Overrides Function GetSchemaSerializable() As
System.Xml.Schema.XmlSchema

Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream

Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing))

stream.Position = 0

Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing)

End Function


Friend Sub InitVars()

Me.tableSociete = CType(Me.Tables("Societe"),SocieteDataTable)

If (Not (Me.tableSociete) Is Nothing) Then

Me.tableSociete.InitVars

End If

Me.tableAnnuaire = CType(Me.Tables("Annuaire"),AnnuaireDataTable)

If (Not (Me.tableAnnuaire) Is Nothing) Then

Me.tableAnnuaire.InitVars

End If

Me.tablePays = CType(Me.Tables("Pays"),PaysDataTable)

If (Not (Me.tablePays) Is Nothing) Then

Me.tablePays.InitVars

End If

Me.tableSection = CType(Me.Tables("Section"),SectionDataTable)

If (Not (Me.tableSection) Is Nothing) Then

Me.tableSection.InitVars

End If

Me.tableSite = CType(Me.Tables("Site"),SiteDataTable)

If (Not (Me.tableSite) Is Nothing) Then

Me.tableSite.InitVars

End If

End Sub


Private Sub InitClass()

Me.DataSetName = "ClasseDsGeneral"

Me.Prefix = ""

Me.Namespace = "http://www.tempuri.org/ClasseDsGeneral.xsd"

Me.Locale = New System.Globalization.CultureInfo("fr-FR")

Me.CaseSensitive = false

Me.EnforceConstraints = true

Me.tableSociete = New SocieteDataTable

Me.Tables.Add(Me.tableSociete)

Me.tableAnnuaire = New AnnuaireDataTable

Me.Tables.Add(Me.tableAnnuaire)

Me.tablePays = New PaysDataTable

Me.Tables.Add(Me.tablePays)

Me.tableSection = New SectionDataTable

Me.Tables.Add(Me.tableSection)

Me.tableSite = New SiteDataTable

Me.Tables.Add(Me.tableSite)

End Sub


Private Function ShouldSerializeSociete() As Boolean

Return false

End Function


Private Function ShouldSerializeAnnuaire() As Boolean

Return false

End Function


Private Function ShouldSerializePays() As Boolean

Return false

End Function


Private Function ShouldSerializeSection() As Boolean

Return false

End Function


Private Function ShouldSerializeSite() As Boolean

Return false

End Function


Private Sub SchemaChanged(ByVal sender As Object, ByVal e As
System.ComponentModel.CollectionChangeEventArgs)

If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then

Me.InitVars

End If

End Sub


Public Delegate Sub SocieteRowChangeEventHandler(ByVal sender As Object,
ByVal e As SocieteRowChangeEvent)


Public Delegate Sub AnnuaireRowChangeEventHandler(ByVal sender As Object,
ByVal e As AnnuaireRowChangeEvent)


Public Delegate Sub PaysRowChangeEventHandler(ByVal sender As Object, ByVal
e As PaysRowChangeEvent)


Public Delegate Sub SectionRowChangeEventHandler(ByVal sender As Object,
ByVal e As SectionRowChangeEvent)


Public Delegate Sub SiteRowChangeEventHandler(ByVal sender As Object, ByVal
e As SiteRowChangeEvent)

etc...
 
D

David Browne

Gilbert Tordeur said:
Environment : Visual Studio 2003 v 7.1.3088 (French)
Development of a Windows application with SQL Server 2000

I get the following compile error message in the .xsd module :
C:\Documents
and Settings\TORDEUR.FRYORKF\Mes documents\Visual Studio
Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly Property
Site()
As SiteDataTable' et 'Public Overrides Property Site() As
System.ComponentModel.ISite' ne peuvent pas se surcharger mutuellement,
car
seul 'ReadOnly' ou 'WriteOnly' les différencie. 'Shadows' est pris en
compte
par défaut.

Translation : C:\Documents and Settings\TORDEUR.FRYORKF\Mes
documents\Visual
Studio Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly
Property
Site() As SiteDataTable' and 'Public Overrides Property Site() As
System.ComponentModel.ISite' cannot override each other, because only the
return types are different. 'Shadows' is taken into account by default.

What does that mean ? What can I do ? I have not this problem with other
tables, only when I call this one. I have deleted everything and set it
again : the error comes again. Thank you for your help.

In the XSD, change the codegen:typedName of the column Site to something
else by adding a codegen attribute to the xs:element tag for the Site
column, eg

<xs:element name="Site" codegen:typedName="SiteID" codegen:nullValue=""
type="xs:string" minOccurs="0" />


See, in general,

http://msdn.microsoft.com/library/d...tml/cpconusingannotationswithtypeddataset.asp

For how to control all sorts of usefull things about the dataset class
through the XSD.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top