Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exception thrown: 'System.IO.FileNotFoundException' sqlite Pin
Richard Deeming22-Jan-20 8:54
mveRichard Deeming22-Jan-20 8:54 
Questionhow flip the canvas vertically ? Pin
Le@rner22-Jan-20 1:56
Le@rner22-Jan-20 1:56 
AnswerRe: how flip the canvas vertically ? Pin
OriginalGriff22-Jan-20 2:29
mveOriginalGriff22-Jan-20 2:29 
GeneralRe: how flip the canvas vertically ? Pin
Le@rner22-Jan-20 19:19
Le@rner22-Jan-20 19:19 
AnswerRe: how flip the canvas vertically ? Pin
Gerry Schmitz22-Jan-20 7:26
mveGerry Schmitz22-Jan-20 7:26 
QuestionAsp.net Pin
RajaMohammed.A22-Jan-20 1:35
RajaMohammed.A22-Jan-20 1:35 
AnswerRe: Asp.net Pin
OriginalGriff22-Jan-20 2:29
mveOriginalGriff22-Jan-20 2:29 
AnswerRe: Asp.net Pin
Richard Deeming22-Jan-20 3:11
mveRichard Deeming22-Jan-20 3:11 
NB: You can't use Office Interop in an ASP.NET application:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

Use a tool like EPPlus[^], ClosedXML[^], or The OpenXML SDK[^] to generate an Excel file.

For example, EPPlus provides both LoadFromDataReader and LoadFromDataTable methods which you could use to load the data from your query into the Excel file.
C#
// Load the data from your stored procedure:
DataTable dt = LoadDataFromStoredProcedure();

// Export the data to an Excel file:
var pck = new ExcelPackage();
var wsDt = pck.Workbook.Worksheets.Add("FromDataTable");
wsDt.Cells["A1"].LoadFromDataTable(dt, /* PrintHeaders: */ true, TableStyles.Medium9);

// Send the Excel file back to the user:
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
pck.SaveAs(Response.OutputStream);
Response.Flush();

// If you're running this code from a page (.aspx) instead of a generic handler (.ashx):
Response.SuppressContent = true;
Context.ApplicationInstance.CompleteRequest();




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

AnswerRe: Asp.net Pin
Gerry Schmitz22-Jan-20 7:37
mveGerry Schmitz22-Jan-20 7:37 
QuestionConvert the data intered by the user to integer number Pin
Member 906313820-Jan-20 22:37
Member 906313820-Jan-20 22:37 
AnswerRe: Convert the data intered by the user to integer number Pin
OriginalGriff20-Jan-20 22:47
mveOriginalGriff20-Jan-20 22:47 
AnswerRe: Convert the data intered by the user to integer number Pin
ZurdoDev21-Jan-20 3:09
professionalZurdoDev21-Jan-20 3:09 
QuestionClear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 0:49
Lupu5R3x18-Jan-20 0:49 
AnswerRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 1:45
mveOriginalGriff18-Jan-20 1:45 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 4:17
Lupu5R3x18-Jan-20 4:17 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 4:43
mveDave Kreskowiak18-Jan-20 4:43 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:51
Lupu5R3x18-Jan-20 6:51 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Richard MacCutchan18-Jan-20 4:52
mveRichard MacCutchan18-Jan-20 4:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:53
Lupu5R3x18-Jan-20 6:53 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 4:52
mveOriginalGriff18-Jan-20 4:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 6:57
Lupu5R3x18-Jan-20 6:57 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 7:01
mveOriginalGriff18-Jan-20 7:01 
AnswerRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 7:00
mveGerry Schmitz18-Jan-20 7:00 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:09
Lupu5R3x18-Jan-20 7:09 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 16:03
mveDave Kreskowiak18-Jan-20 16:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.