S
Steve Drake
All,
I am writting an app pre load excel spreadsheets with lots of data, I want
to be abil to use the command builder for easy coding, but it dont seam to
work with Excel, I have the following code :
OleDbDataAdapter myAd = new OleDbDataAdapter();
myAd.SelectCommand = new OleDbCommand( @"select FIELD_1,FIELD_2,FIELD_3
from [TABLE$]",myCon);
OleDbCommandBuilder cb = new OleDbCommandBuilder(myAd);
/* IF I UNCOMMENT THIS IT WORKS
myAd.InsertCommand = new OleDbCommand( "INSERT INTO [TABLE$] (FIELD_1,
FIELD_2, FIELD_3) VALUES (?, ?,?)", myCon );
myAd.InsertCommand.Parameters.Add("@FIELD_1", OleDbType.VarChar,
255,"FIELD_1");
myAd.InsertCommand.Parameters.Add("@FIELD_2",
OleDbType.VarChar,255).SourceColumn ="FIELD_2";
myAd.InsertCommand.Parameters.Add("@FIELD_3",OleDbType.VarChar,255).SourceCo
lumn = "FIELD_3";
*/
myAd.Update(DataSetWithDataIn);
I am writting an app pre load excel spreadsheets with lots of data, I want
to be abil to use the command builder for easy coding, but it dont seam to
work with Excel, I have the following code :
OleDbDataAdapter myAd = new OleDbDataAdapter();
myAd.SelectCommand = new OleDbCommand( @"select FIELD_1,FIELD_2,FIELD_3
from [TABLE$]",myCon);
OleDbCommandBuilder cb = new OleDbCommandBuilder(myAd);
/* IF I UNCOMMENT THIS IT WORKS
myAd.InsertCommand = new OleDbCommand( "INSERT INTO [TABLE$] (FIELD_1,
FIELD_2, FIELD_3) VALUES (?, ?,?)", myCon );
myAd.InsertCommand.Parameters.Add("@FIELD_1", OleDbType.VarChar,
255,"FIELD_1");
myAd.InsertCommand.Parameters.Add("@FIELD_2",
OleDbType.VarChar,255).SourceColumn ="FIELD_2";
myAd.InsertCommand.Parameters.Add("@FIELD_3",OleDbType.VarChar,255).SourceCo
lumn = "FIELD_3";
*/
myAd.Update(DataSetWithDataIn);