Insert into sysntax error



Hi

Enyone can help to fix the issue.

I have an issue while i am trying to insert some records in excel thru
DataAdapter.Update() in .net .It shows the error

'Syntax error in INSERT INTO statement.'

I got records as output of a stored procedure and try insert those records
to excel.

I give the code for that .Even I am using default column name like F1,F2...
in excel no reserve keyword.

SqlDataAdapter test=new SqlDataAdapter(oCommand);
test.AcceptChangesDuringFill = false;
DataSet dsTest=new DataSet();
test.Fill(dsTest);



string strConn;

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source = "+ sFileName+"; Jet OLEDB:Engine Type=5;"+

"Extended Properties=Excel 8.0;";


conn = new OleDbConnection(strConn);

OleDbDataAdapter myCommand = new OleDbDataAdapter( "Select * from [" +
Exsheetname + "$A6:X100] ", strConn);


OleDbCommandBuilder sqlcb=new OleDbCommandBuilder(myCommand);




DataSet Mydataset=new DataSet();

myCommand.Fill(Mydataset);


Mydataset=dsTest.Copy();
if(Mydataset.HasChanges())
myCommand.Update(Mydataset);


Regards
Kalidoss.V

.


Loading