IfxCommandBuilder examples
The first example shows you how to perform an update using
an IfxCommandBuilder object.
// IfxConnection -- con
DataSet ds = new DataSet();
string sql = "select fname, lname from customer";
IfxDataAdapter da = new IfxDataAdapter(sql,con);
//Build new CommandBuilder
IfxCommandBuilder ifxbuilder = new IfxCommandBuilder(da);
con.Open();
da.Fill(ds,"customer");
//code to modify data in DataSet goes here
ds.Tables[0].Rows[0].ItemArray[0] = "William";
//the following line will fail without the IfxCommandBuilder
//as we have not explicitly set an UpdateCommand in the DataAdapter
da.Update(ds,"customer");
This example shows how to retrieve information about parameters
for stored procedures.
// IfxConnection - con
IfxCommand cmd = new IfxCommand("SP_GETUSERINFO",con);
IfxCommandBuilder cb = new IfxCommandBuilder();
con.Open();
IfxCommandBuilder.DeriveParameters(cmd);
foreach (IfxParameter param in cmd.Parameters)
{
Console.WriteLine(param.ParameterName);
}
con.Close();