Nonstop Database, HiRDB Version 9 UAP Development Guide
This example displays all table data:
Although the sample program is coded in Visual C# .NET, the program in Visual Basic.NET would be almost the same (if necessary, change information as appropriate).
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) 2011, Hitachi, Ltd.