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.

Reply via email to