DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   transfer contends from database table to excel (http://www.daniweb.com/forums/thread151507.html)

carobee Oct 16th, 2008 5:41 am
transfer contends from database table to excel
 
hi,
i want to transfer the contends of a table from database to excel. can i declare a excel sheet in c#

LizR Oct 16th, 2008 6:53 am
Re: transfer contends from database table to excel
 
Have an ask of google. Google knows the answers

carobee Oct 16th, 2008 9:02 am
Re: transfer contends from database table to excel
 
done dat. am able to do it now. but i want the column names also. Is that possible?

LizR Oct 16th, 2008 9:04 am
Re: transfer contends from database table to excel
 
f you need to putput it, and keep the names, put the names into an array you can output as a header line.

carobee Oct 16th, 2008 9:21 am
Re: transfer contends from database table to excel
 
Also if i want to save it somewhere of my wish what would the code be like. i have defined a workbook also populated the values. now while saving it is saving in the same place where project is created. i want to save it in some other place. my code is
wb.SaveAs(FileName,Excel.XlFileFormat.xlWorkbookNormal,
null,null,false,false,Excel.XlSaveAsAccessMode.xlShared,
false,false,null,null,null);
what changes do i make?

LizR Oct 16th, 2008 9:32 am
Re: transfer contends from database table to excel
 
Change the filename.. or is there some hidden part to that question

carobee Oct 16th, 2008 9:39 am
Re: transfer contends from database table to excel
 
wb.SaveAs(FileName,Excel.XlFileFormat.xlWorkbookNormal,
null,null,false,false,Excel.XlSaveAsAccessMode.xlShared,
false,false,null,null,null);

this is my code ? can you suggest any solution

LizR Oct 16th, 2008 9:55 am
Re: transfer contends from database table to excel
 
Now you really are being stupid

the contents of "Filename" has to be what you wanted..

carobee Oct 22nd, 2008 1:20 am
Re: transfer contends from database table to excel
 
The contents of "Filename" that i can provide is just the any name for the file, not like "C:\....". it is getting saved in my documents folder.
Please give a proper solution

LizR Oct 22nd, 2008 2:33 am
Re: transfer contends from database table to excel
 
Sorry, but you are being stupid,

Put the path in your filename, and it will be saved where you tell it..... If you dont it would be saved in whats the "current directory"


All times are GMT -4. The time now is 6:41 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC