Personal Xls Dosyası Nerde?
April 17th, 2009 — 6:58am
Xp’de
C:\Documents and Settings\Serdar\Application Data\Microsoft\Excel\XLSTART
Vista’da
C:\Users\Ron\AppData\Roaming\Microsoft\Excel\XLSTART
Serdar's
Xp’de
C:\Documents and Settings\Serdar\Application Data\Microsoft\Excel\XLSTART
Vista’da
C:\Users\Ron\AppData\Roaming\Microsoft\Excel\XLSTART
Your datatable must have captions for better view.
Excel.Application xlApp = new Excel.Application(); xlApp.Visible = false; Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Excel.Workbook wb = xlApp.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet); Excel.Worksheet ws = (Excel.Worksheet)wb.Sheets[1]; //capion work you can delete it if you want for (int r = 0; r < dtExcel.Columns.Count; r++) { Excel.Range field = (Excel.Range)ws.Cells[1, r + 1]; field.Formula = dtExcel.Columns[r].Caption; } for (int i = 0; i < dtExcel.Rows.Count; i++) { for (int j = 0; j < dtExcel.Columns.Count; j++) { Excel.Range field = (Excel.Range)ws.Cells[i + 2, j + 1]; field.Formula = dtExcel.Rows[i][j].ToString(); } } ws.Cells.EntireColumn.AutoFit(); wb.SaveAs(fileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); wb.Close(true, Missing.Value, Missing.Value); xlApp.Quit();
Excel ile sqlserver‘a bağlanıp, satır ve sütun sayısı taşmıyorsa, bilgi çekebilsiniz.

import data
Yapılması gerekenleri madde madde yazacak olursak şöyle,

sql server connection

user - password
Dilerseniz joinli bir sorgu ilede bilgi çekebilirsiniz. Edit query komutuna basarak isteğiniz sorguyu yazıp çekebilirsiniz.

edit query - refresh
Çektiğiniz data kendini güncellemez bunu ünlem şeklindeki butona basarak biz yapmalıyız.