P
pRumpf
Hi
I translate an prior application written in Clipper to C#....
The Application reads Cobol Files (EBCDIC, BCD numbers....) and inserts
the data into a rdbms. This part is no problm to realize in C#.
The original App. create SQL Statements as string/text and execute them
with the Database command-Line-Interactiv-SQL Tool (run iSql.exe
"...sql....") because there is no ODBC or OleDB Support in Clipper
e.g.
sql = "insert into t01.data (field1, field2, field3) values (200,
123.90, 'Bread' );
"insert into ......;"
....
Now my Question has onyone experience using OleDBParameter /
performance.
What is the better (speediest) way:
1) Creating the complete sql command as text string and execute (e.g.)
conn = new OleDbConnection( myConnectionString );
conn.Open();
// here is the loop overall Cobol records....
// the values (200, 123.90, Bread) comes out of the Cobol-Record
// to simplify the example:
string sql = "insert into t01.data (field1, field2, field3) values
(200, 123.90, 'Bread' );"
cmd= new OleDbCommand(sql, conn);
cmd.ExecuteNonQuery();
....
2) Using OleDbParameters
conn = new OleDbConnection( myConnectionString );
conn.Open();
string sql = insert into t01.data (field1, field2, field3) values
(?, ? , ?);"
cmd= new OleDbCommand(sql, conn);
// here is the loop overall Cobol records
//...
cmd.Parameters.Clear();
cmd.Parameters.Add("@p1", ...).Value = 200;
cmd.Parameters.Add("@p2", ...).Value = 123,90;
cmd.Parameters.Add("@p3", ...).Value = "Bread";
OleDbDataReader dr = cmd.ExecuteNonQuery();
3) maybe another way.... ?
Which way is the speediest. Has anyone experince ?
Thank you
I translate an prior application written in Clipper to C#....
The Application reads Cobol Files (EBCDIC, BCD numbers....) and inserts
the data into a rdbms. This part is no problm to realize in C#.
The original App. create SQL Statements as string/text and execute them
with the Database command-Line-Interactiv-SQL Tool (run iSql.exe
"...sql....") because there is no ODBC or OleDB Support in Clipper
e.g.
sql = "insert into t01.data (field1, field2, field3) values (200,
123.90, 'Bread' );
"insert into ......;"
....
Now my Question has onyone experience using OleDBParameter /
performance.
What is the better (speediest) way:
1) Creating the complete sql command as text string and execute (e.g.)
conn = new OleDbConnection( myConnectionString );
conn.Open();
// here is the loop overall Cobol records....
// the values (200, 123.90, Bread) comes out of the Cobol-Record
// to simplify the example:
string sql = "insert into t01.data (field1, field2, field3) values
(200, 123.90, 'Bread' );"
cmd= new OleDbCommand(sql, conn);
cmd.ExecuteNonQuery();
....
2) Using OleDbParameters
conn = new OleDbConnection( myConnectionString );
conn.Open();
string sql = insert into t01.data (field1, field2, field3) values
(?, ? , ?);"
cmd= new OleDbCommand(sql, conn);
// here is the loop overall Cobol records
//...
cmd.Parameters.Clear();
cmd.Parameters.Add("@p1", ...).Value = 200;
cmd.Parameters.Add("@p2", ...).Value = 123,90;
cmd.Parameters.Add("@p3", ...).Value = "Bread";
OleDbDataReader dr = cmd.ExecuteNonQuery();
3) maybe another way.... ?
Which way is the speediest. Has anyone experince ?
Thank you