c# - Export Oracle Data with ODP.NET into an Excel File with C Sharp -


I am trying to export the query result set in an Excel sheet. I need to run 8 questions, each of which will be a separate sheet in the Excel file. I need to add some formatting around the sheet (adding a header, the report looks good, etc.).

Currently, my code is only running one query (hence only one sheet data). It fills 4000 rows with 7 columns and takes a long time for a small sample. Is there a better way to do this? Thanks a lot! Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; Object Mist Value = System. reflection. missing. Value; String data = null; Int i = 0; Int j = 0; XlApp = New Excel.ApplicationClass (); XlWorkBook = xlApp.Workbooks.Add (MySQL); XlWorkSheet = (Excel Worksheet) xlWorkBook.Worksheets.get_Item (1); String cs = "Filter Oracle Connection String To Post Online"; Dataset ds = new dataset (); OracleConnection oakon = new oracle connection (CS); Oconn.Open (); Model_Netstat netstat = new Model_Netstat (); OracleCommand OC = New OracleCommand (netstat.queryNetstatAll (session.caseName), oconn); O.CommandType = CommandType.Text; OracleDataAdapter oda = New Oracleadata Adapter (OC); Try Oda.Fill (DS); } Hold (Exception Pre) {Console.Write (ex.Message); } (I = 0; I & lt; = ds.Tables [0] .Rows.Count - 1; i ++) {for (j = 0; j & lt; = ds.Tables [0] .Columns Count - 1; J ++) {data = ds.Tables [0] .ows [i] .ememArray [ja] .ToString (); XlWorkSheet.Cells [i + 1, j + 1] = data; }} Kslvrkbukkswas ( "Testkksls" Akselkclfilformtkkslvrkbuknorml, Misvlua, Misvlua, Misvlua, Misvlua, Akselkglsveasksessmodekshlaksclusive, Misvlua, Misvlua, Misvlua, Misvlua, Misvlua); XlWorkBook Close (true, misswale, misty value); XlApp.Quit (); ReleaseObject (xlWorkSheet); ReleaseObject (xlWorkBook); ReleaseObject (xlApp); Czech free from outside Microsoft, it is you need without automation and much more. Faster than is usable in ASP.NET (automation There is not supported) ...

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -