VistaDB 5
Example 






GetSchemaTable Method (VistaDBDataReader)
Create a DataTable containing DataColumn objects that correspond to the columns returned by your query.
Syntax
'Declaration
 
Public Overrides NotOverridable Function GetSchemaTable() As System.Data.DataTable
'Usage
 
Dim instance As VistaDBDataReader
Dim value As System.Data.DataTable
 
value = instance.GetSchemaTable()
public override System.Data.DataTable GetSchemaTable()
public function GetSchemaTable(): System.Data.DataTable; override; 
public override function GetSchemaTable() : System.Data.DataTable;
public: System.Data.DataTable* GetSchemaTable(); override 
public:
System.Data.DataTable^ GetSchemaTable(); override 

Return Value

A DataTable that describes the column metadata.
Remarks
Each call to this method will return a new DataTable object.
Example
using (VistaDBConnection cn = new VistaDBConnection("Data Source=|DataDirectory|Database1.vdb5;"))
{
    cn.Open();
 
    using (VistaDBCommand cmd = new VistaDBCommand("Select * from employees", cn ) )
    {
        using (VistaDBDataReader myReader = cmd.ExecuteReader(CommandBehavior.KeyInfo))
        {
            //Retrieve column schema into a DataTable.
            DataTable schemaTable = myReader.GetSchemaTable();
 
            foreach (DataRow myField in schemaTable.Rows)
            {
                foreach (DataColumn myProperty in schemaTable.Columns)
                {
                    Console.WriteLine(myProperty.ColumnName + " = " +
                            myField[myProperty].ToString());
                }
                Console.WriteLine();
            }
        }
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also