Typed Dataset "Region" Table

M

Mark

Hello
Whenever I create a typed dataset using Northiwnd Database
and add "Region" table. I don't know why I am getting "_"
ahead of "Region" when I try to access "Region" table.
The Sample Code is as follows.

The typed Schema

<xs:schema id="dsRegion" ..>
<xs:element name="dsRegion" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Region">
<xs:complexType>
<xs:sequence>
<xs:element name="RegionID" type="xs:int" />
<xs:element name="RegionDescription"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="dsRegionPK" msdata:primaryKey="true">
<xs:selector xpath=".//mstns:Region" />
<xs:field xpath="mstns:RegionID" />
</xs:unique>
</xs:element>
</xs:schema>

And the code I used to access is

Dim lmyRegionDataSet As ADO.dsRegion
Dim lmyTable As DataTable
lmyTable = lmyRegionDataSet._Region()

Now why there is "_" ahead of region table?
Why can't i access it like

lmyTable = lmyRegionDataSet.Region()

like other tables


Regards

Mark
 
M

Miha Markic

Hi Mark,

I would guess that VB.NET is afraid of Region because it thinks that it may
be a keyword or some other reseved word.
There is #Region directive.
The same example works just fine with C# so it has something to do with
VB.NET.
 
M

Mark

Good point miha
you are right it works same for other vb keywords
like "MyBase"

now just look a sample class below

Public Class MyTestClass
Public Region As System.String
End Class

now i can write as follows

Dim x as MyTestClass = new MyTestClass
msgbox (x.Region)

why same rule is not applying here?
how you will relate a "Table" and a "Typed dataset"
I think the "region" (table) as a property of "dsRegion"
(typed dataset)
is it correct?
please correct me if I am wrong.

Mark
 
M

Miha Markic

Hi Mark,

There is a code line
Private table_Region As _RegionDataTable

in dataset.


--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

....
 

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