using (DbCommand command = oconn.CreateCommand())
{
command.CommandText = "CREATE TABLE [Sheet2$] (F1 number, F2 char(255), F3 char(128))";
command.ExecuteNonQuery();
for (int i = 1; i <= 20; i++)
{
//now we insert the values into the existing sheet...no new sheet is added.
command.CommandText = "INSERT INTO [Sheet2$] (F1, F2, F3) VALUES(1,\"Fake Record\",\"Fake Record\")";
command.ExecuteNonQuery();
}
}
I am using this code to insert some records in excel file sheet . What i want to do is to see if for example Sheet1 is there then create sheet 2 and insert these records there . and if it only finds sheet 3 then i want to create another sheet4 and insert the records there and so on. how can i do this?
Try to check the tables of the data schema: