public void CUBRIDCommand_Prepare_Basic_Test() { using (CUBRIDConnection conn = new CUBRIDConnection(DBHelper.connString)) { conn.Open(); DBHelper.ExecuteSQL("drop table if exists t", conn); DBHelper.ExecuteSQL("create table t (id int, name varchar(50))", conn); CUBRIDCommand cmd = new CUBRIDCommand(null, conn); LogTestStep("Test Prepare"); cmd.CommandText = "insert into t (id, name) values (?, ?)"; CUBRIDParameter idParam = new CUBRIDParameter("?", CUBRIDDataType.CCI_U_TYPE_INT, 8); CUBRIDParameter nameParam = new CUBRIDParameter("?", CUBRIDDataType.CCI_U_TYPE_STRING, 20); idParam.Value = 2; nameParam.Value = "Rachel Green"; cmd.Parameters.Add(idParam); cmd.Parameters.Add(nameParam); Log("Call Prepare after setting the Commandtext and Parameters."); cmd.Prepare(); cmd.ExecuteNonQuery(); Log("Change parameter values and call ExecuteNonQuery."); cmd.Parameters[0].Value = 5; cmd.Parameters[1].Value = "Bill Gates"; cmd.ExecuteNonQuery(); Log("Verify the date are inserted by querying them from db"); cmd = new CUBRIDCommand("select * from t", conn); CUBRIDDataAdapter adapter = new CUBRIDDataAdapter(cmd); DataTable dt = new DataTable(); adapter.Fill(dt); Assert.AreEqual(2, dt.Rows.Count); Assert.AreEqual(2, (int)dt.Rows[0][0]); Assert.AreEqual("Rachel Green", dt.Rows[0][1].ToString()); Assert.AreEqual(5, (int)dt.Rows[1][0]); Assert.AreEqual("Bill Gates", dt.Rows[1][1].ToString()); LogStepPass(); cmd.Close(); Log("delete test table"); DBHelper.ExecuteSQL("drop table if exists t", conn); LogTestResult(); } }