using System;
using Raima.Rdm;
namespace HelloWorld_CS_ADO
{
class Program
{
static void CreateDatabase()
{
RdmConnection createConn = new RdmConnection("host=local");
createConn.Open();
RdmCommand createCmd = createConn.CreateCommand();
try
{
createCmd.CommandText = "CREATE DATABASE HelloWorld";
createCmd.ExecuteNonQuery();
createCmd.CommandText = "CREATE TABLE HelloTab (message CHAR(30))";
createCmd.ExecuteNonQuery();
createCmd.CommandText = "COMMIT";
createCmd.ExecuteNonQuery();
}
catch (Exception)
{
}
createConn.Close();
}
static void Main(string[] args)
{
CreateDatabase();
RdmConnection conn = new RdmConnection("host=local;database=HelloWorld;openmode=Exclusive");
conn.Open();
RdmCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO HelloTab VALUES 'Hello World'";
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT message FROM HelloTab";
RdmDataReader reader = cmd.ExecuteReader();
while (reader.Read())
Console.WriteLine(reader[0]);
conn.Close();
}
}
}