Returns a Table object which represents a dBase file or a shapefile stored in a directory.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public Table OpenTable(
	string name
)
Visual Basic (Declaration)
Public Function OpenTable ( _
	name As String _
) As Table

Parameters

name
Type: System..::.String

The name of the dBase table or shapefile to open. The file extension (.shp or .dbf) is optional.

Return Value

A Table object which represents either a dBase table (non-spatial) or a shapefile (spatial, vector format).

Examples

The code below creates a DataDirectory object which is then used to open a number of data types including a shapefile and a dBase table in the first and second examples respectively.
CopyC#
//Create a DataDirectory object for the specified file path
DataDirectory dir = new DataDirectory(@"C:\Data");

//Print the path to the data
System.Diagnostics.Debug.Print(dir.Path); //Prints "C:\Data"

//Example 1 - open the mountains shapefile then print the name and whether it can store vector data.
Table mtnsTable = dir.OpenTable("mountains");
System.Diagnostics.Debug.Print(mtnsTable.Name);                   //Prints "mountains"
System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString());   //Prints "True"

//Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data.
Table ratingsTable = dir.OpenTable("mtn_ratings");
System.Diagnostics.Debug.Print(ratingsTable.Name);                 //Prints "mtn_ratings"
System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()); //Prints "False"

//Example 3 - open the southgorms.jpg raster file and print the name
Raster gormsRaster = dir.OpenRaster("northgorms.jpg");
System.Diagnostics.Debug.Print(gormsRaster.Name);                  //Prints "northgorms.jpg""
CopyVB.NET
'Create a DataDirectory object for the specified file path
Dim dir As DataDirectory = New DataDirectory("C:\Data")

'Print the path to the data
System.Diagnostics.Debug.Print(dir.Path) 'Prints "C:\Data"


'Example 1 - open the mountains shapefile then print the name and whether it can store vector data.
Dim mtnsTable As Table = dir.OpenTable("mountains")
System.Diagnostics.Debug.Print(mtnsTable.Name)                   'Prints "mountains"
System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString())   'Prints "True"


'Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data.
Dim ratingsTable As Table = dir.OpenTable("mtn_ratings")
System.Diagnostics.Debug.Print(ratingsTable.Name)                 'Prints "mtn_ratings"
System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()) 'Prints "False"


'Example 3 - open the southgorms.jpg raster file and print the name
Dim gormsRaster As Raster = dir.OpenRaster("northgorms.jpg")
System.Diagnostics.Debug.Print(gormsRaster.Name)                  'Prints "northgorms.jpg"

See Also