Click here to Skip to main content
14,454,632 members
   

C#

 
AnswerRe: Exception thrown: 'System.IO.FileNotFoundException' sqlite Pin
Richard Deeming22-Jan-20 9:54
communityengineerRichard Deeming22-Jan-20 9:54 
Questionhow flip the canvas vertically ? Pin
Le@rner22-Jan-20 2:56
MemberLe@rner22-Jan-20 2:56 
AnswerRe: how flip the canvas vertically ? Pin
OriginalGriff22-Jan-20 3:29
communityengineerOriginalGriff22-Jan-20 3:29 
GeneralRe: how flip the canvas vertically ? Pin
Le@rner22-Jan-20 20:19
MemberLe@rner22-Jan-20 20:19 
AnswerRe: how flip the canvas vertically ? Pin
Gerry Schmitz22-Jan-20 8:26
mveGerry Schmitz22-Jan-20 8:26 
QuestionAsp.net Pin
RajaMohammed.A22-Jan-20 2:35
MemberRajaMohammed.A22-Jan-20 2:35 
AnswerRe: Asp.net Pin
OriginalGriff22-Jan-20 3:29
communityengineerOriginalGriff22-Jan-20 3:29 
AnswerRe: Asp.net Pin
Richard Deeming22-Jan-20 4:11
communityengineerRichard Deeming22-Jan-20 4: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.
// 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 8:37
mveGerry Schmitz22-Jan-20 8:37 
QuestionConvert the data intered by the user to integer number Pin
Member 906313820-Jan-20 23:37
MemberMember 906313820-Jan-20 23:37 
AnswerRe: Convert the data intered by the user to integer number Pin
OriginalGriff20-Jan-20 23:47
communityengineerOriginalGriff20-Jan-20 23:47 
AnswerRe: Convert the data intered by the user to integer number Pin
ZurdoDev21-Jan-20 4:09
mveZurdoDev21-Jan-20 4:09 
QuestionClear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 1:49
MemberLupu5R3x18-Jan-20 1:49 
AnswerRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 2:45
communityengineerOriginalGriff18-Jan-20 2:45 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 5:17
MemberLupu5R3x18-Jan-20 5:17 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 5:43
mveDave Kreskowiak18-Jan-20 5:43 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:51
MemberLupu5R3x18-Jan-20 7:51 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Richard MacCutchan18-Jan-20 5:52
communityengineerRichard MacCutchan18-Jan-20 5:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:53
MemberLupu5R3x18-Jan-20 7:53 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 5:52
communityengineerOriginalGriff18-Jan-20 5:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:57
MemberLupu5R3x18-Jan-20 7:57 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 8:01
communityengineerOriginalGriff18-Jan-20 8:01 
AnswerRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 8:00
mveGerry Schmitz18-Jan-20 8:00 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 8:09
MemberLupu5R3x18-Jan-20 8:09 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 17:03
mveDave Kreskowiak18-Jan-20 17: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.