Nonstop Database, HiRDB Version 9 UAP Development Guide
This example creates a table named ex:
using System; 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(); // Create a table cm.Connection = cn; cm.CommandText = "create table ex (a int)"; cm.ExecuteNonQuery(); ..................................1 // Disconnect from the database cn.Close(); } catch (HiRDBException ex) { Console.WriteLine(ex); } catch (System.Exception ex) { Console.WriteLine(ex); } } } } |
Imports System Imports System.Data Imports Hitachi.HiRDB Module Module1 Sub Main() Dim cn As HiRDBConnection Dim cm As HiRDBCommand Try ' Create a Connection object cn = New HiRDBConnection("dsn=pc;") ' Connect to the database cn.Open() ' Create in the Command object cm = New HiRDBCommand() ' Create a table cm.Connection = cn cm.CommandText = "create table ex (a int)" cm.ExecuteNonQuery() .......................................1 ' Disconnect from the database cn.Close() Catch ex As HiRDBException Console.WriteLine(ex) Catch ex As System.Exception Console.WriteLine(ex) End Try End Sub End Module |
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.