Sorry for my delay but i was out of office. i've already tried this solutions but it's not working.. visual studio gave me the same errore of always..
so i found asolutions with Developer Express .NET, I'm filling a table(Xgrid one) There is a method of the table that allow me to print all data inside the table into a xls file. so the problem was solved.. but the instructions of the 1 post, are not still working.. thanks for your help kira. Matteo. On 3 Lug, 07:17, Kira Qian <[email protected]> wrote: > Hi, > > You have missing HDR property in your connection > string.http://www.connectionstrings.com/excel > "HDR=Yes;" indicates that the first row contains columnnames, not > data. > "HDR=No;" indicates the opposite. > > If I misunderstood you, please feel free to tell me. > > On Jul 2, 5:16 pm, Matteo <[email protected]> wrote: > > > Hi all. > > i want to insert a new row in an empty .xlsx file via SQL > > instructions.. > > This is the code : > > > 'Dim MyConnection As System.Data.OleDb.OleDbConnection > > 'Dim MyCommand As New System.Data.OleDb.OleDbCommand > > 'MyConnection = New System.Data.OleDb.OleDbConnection > > ("provider=Microsoft.ACE.OLEDB.12.0;Data 'Source='c: > > \modello.xlsx';Extended Properties=Excel 8.0;") > > 'MyConnection.Open() > > 'MyCommand.Connection = MyConnection > > 'MyCommand.CommandTimeout = 0 > > 'MyCommand.CommandText = "Insert into [Foglio1$] values > > ('aa','cc','sd','kk')" > > 'MyCommand.ExecuteNonQuery() > > 'MyConnection.Close() > > > My problem is that when the compiler try to add the new row, he > > doesn't konw where to put them because he doesn't know the name of the > > coloum in the .xlsx file( that Is empty). > > Instead if in the file there is already a row.. it works!!, only if > > the number of the cell filled(in the first row) is the same of the > > parameters that i want to write(those of sql instructions , Insert > > into [Foglio1$] values ('aa','cc','sd','kk') ).. > > > thanks in advance > > Matteo.
