1.1.1

Table Of Contents
prm.DbType = DbType.Int32;
prm.Value = i;
cmd.Parameters.Add(prm);
// then the parameter for ADDR is bound by position;
// note that this could even have been first in the list since the other
// parameter is bound by name
prm = cmd.CreateParameter();
prm.ParameterName = "ADDR";
prm.DbType = DbType.String;
prm.Value = "addr" + i;
cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery();
}
// drop the table
cmd = new SQLFCommand("drop table t1", conn);
cmd.ExecuteNonQuery();
conn.Close();
}
Example: Using parameterized commands for batch operations
// Open a new connection to the network server running on localhost:1527
string host = "localhost";
int port = 1527;
string connectionStr = string.Format("server={0}:{1}", host, port);
using (SQLFClientConnection conn = new SQLFClientConnection(connectionStr))
{
conn.Open();
// create a table
SQLFCommand cmd = new SQLFCommand(
"create table t1 (id int primary key, addr varchar(20))", conn);
cmd.ExecuteNonQuery();
// insert into the table using positional parameters
cmd = new SQLFCommand("insert into t1 values (?, ?)", conn);
cmd.Prepare();
for (int i = 0; i < 1000; i++) {
cmd.Parameters.Add(i);
cmd.Parameters.Add("addr" + i);
cmd.AddBatch();
}
int[] results = cmd.ExecuteBatch();
// drop the table
cmd = new SQLFCommand("drop table t1", conn);
conn.Close();
}
Example: Using commands having no parameters for batch operations
// Open a new connection to the network server running on localhost:1527
string host = "localhost";
int port = 1527;
string connectionStr = string.Format("server={0}:{1}", host, port);
using (SQLFClientConnection conn = new SQLFClientConnection(connectionStr))
695
ADO.NET Driver Reference