Nonstop Database, HiRDB Version 9 UAP Development Guide
This example inserts 123, 200, and null in the ex table:
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).
// Create objects such as a connection object HiRDBConnection pConn = new HiRDBConnection("connection-character-string"); HiRDBCommand pCom = pConn.CreateCommand(); // Connect to the database pConn.Open(); // Create a parameter object HiRDBParameter pPar = pCom.CreateParameter(); // Set parameters pPar.Direction = ParameterDirection.Input; pPar.HiRDBType = HiRDBType.Integer; object [] aValue = new object[3]; aValue[0] = 123; aValue[1] = 200; aValue[2] = null; pPar.Value = aValue; pCom.Parameters.Add(pPar); .........................................1 // Use parameters to execute SQL statement pCom.CommandText = "insert into ex values(?)"; pCom.ExecuteNonQuery(aValue.Length); ...............................2 // Disconnect from the database pConn.Close(); |
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.