Scalable Database Server, HiRDB Version 8 UAP Development Guide
This example displays all table data:
using System; using System.Data; using Hitachi.HiRDB; namespace test_C { class Sample { [STAThread] static void Main(string[] args) { try { // Create a Connection object HiRDBConnection cn = new HiRDBConnection("dsn=pc;"); // Connect to the database cn.Open(); // Create a Command object HiRDBCommand cm = new HiRDBCommand(); cm.Connection = cn; cm.CommandText = "select a from ex"; // Create a DataReader object HiRDBDataReader rd = cm.ExecuteReader(); ...............1 int i; while(rd.Read()) { for (i = 0 ; i < rd.FieldCount ; i++) { Console.WriteLine(rd.GetName(i) + " - " +rd.GetValue(i)); } } ......................................................2 // Disconnect from the database cn.Close(); } catch (HiRDBException ex) { Console.WriteLine(ex); } catch (System.Exception ex) { Console.WriteLine(ex); } } } } |
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.