I have a list with many objects which holds byte[8]. I want to insert them into Firebird database as a block. Without the array I can do it like this:
var statement = "EXECUTE BLOCK AS BEGIN ";
foreach (var item in items)
{
statement += "INSERT INTO table (id, val) VALUES ("
+ item.id + ", " + item.val + "); ";
}
statement += "END";
new FbCommand(statement, connection, transaction).ExecuteNonQuery();
When I want to insert into blob, I use something like this:
FbCommand fbc = new FbCommand("INSERT INTO table (id, blob) VALUES (@id, @blob)", connection, transaction);
fbc.Parameters.Add("@id", FbDbType.BigInt).Value = id;
fbc.Parameters.Add("@blob", FbDbType.Binary).Value = blob;
fbc.ExecuteNonQuery();
How to create parametrized statement for more than one row?