Inserting data using oledb into an excel sheet, integers are only displayed as integers:
I already tried to change the properties of the following connection string:
string szConnectionString = $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + myFilePath + "';Extended Properties=\"Excel 12.0;HDR=YES;Readonly=False;\"";
Additionally I tried to create a new sheet/table with data types:
cmd.CommandText = "CREATE TABLE [data3] (quarter VARCHAR, value INT);";
Following my current code inserting data:
cmd.CommandText = "CREATE TABLE [data3] (quarter VARCHAR, value INT);";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO [data3$]([quarter ],[value]) VALUES(?,?)";
cmd.Parameters.AddWithValue("@p1", "2018.06");
cmd.Parameters.AddWithValue("@p2", 13); // <-- INT
cmd.ExecuteNonQuery();
My expectation is that the data are inserted into excel correctly, meaning in the correct format.