Click here to Skip to main content
15,881,898 members
Home / Discussions / C#
   

C#

 
GeneralRe: project file associated with c# application on start Pin
Eddy Vluggen15-Jan-17 1:25
professionalEddy Vluggen15-Jan-17 1:25 
QuestionCan't understand implementation of interface Pin
Mc_Topaz14-Jan-17 3:07
Mc_Topaz14-Jan-17 3:07 
AnswerRe: Can't understand implementation of interface Pin
OriginalGriff14-Jan-17 3:48
mveOriginalGriff14-Jan-17 3:48 
PraiseRe: Can't understand implementation of interface Pin
Mc_Topaz14-Jan-17 4:35
Mc_Topaz14-Jan-17 4:35 
GeneralRe: Can't understand implementation of interface Pin
OriginalGriff14-Jan-17 4:46
mveOriginalGriff14-Jan-17 4:46 
SuggestionRe: Can't understand implementation of interface Pin
Richard Deeming16-Jan-17 2:18
mveRichard Deeming16-Jan-17 2:18 
AnswerRe: Can't understand implementation of interface Pin
BillWoodruff17-Jan-17 16:49
professionalBillWoodruff17-Jan-17 16:49 
QuestionDatatable to Excel Pin
Member 1294766512-Jan-17 11:41
Member 1294766512-Jan-17 11:41 
Hi there everyone, new here and would like to get some feedback on my code.
I run a store procedure that I want to dump on a excel template.
It currently works, but just takes way too long. On sql management studio the query runs good, but just writing to the template is really slow.
Can anyone suggest a more efficient way to achieve the same result?
thanks in advance

here is part of my code:


sdate = StartDate.Value.ToString();
edate = EndDate.Value.ToString();

Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet aSheet;

try
{
//Start Excel and get Application object.
oXL = new Excel.Application();
oXL.Visible = true;

//open the excel template
oWB = oXL.Workbooks.Open("C:\\TEMP\\template.xlsm");

//oWB = (Excel._Workbook)(oXL.Workbooks.Add(Missing.Value));

//Call to service
//aSheet = (Excel._Worksheet)oWB.Worksheets.get_Item(1);
aSheet = (Excel._Worksheet)oWB.ActiveSheet;
//backgroundWorker1.ReportProgress(i++);
writedata_from_proc(aSheet, "dbo.CODE_RED_2017");
//backgroundWorker1.ReportProgress(i++);


//Make sure Excel is visible and give the user control
//of Microsoft Excel's lifetime.
//backgroundWorker1.ReportProgress(i++);
MessageBox.Show("Data extraction complete");
oXL.Visible = true;
oXL.UserControl = true;
//SaveExcel(oWB);

//clean up the COM objects to remove them from the memory
Marshal.FinalReleaseComObject(aSheet);
Marshal.FinalReleaseComObject(oWB);
Marshal.FinalReleaseComObject(oXL);
}
catch (Exception theException)
{
String errorMessage;
errorMessage = "Error: ";
errorMessage = String.Concat(errorMessage, theException.Message);
errorMessage = String.Concat(errorMessage, " Line: ");
errorMessage = String.Concat(errorMessage, theException.Source);

MessageBox.Show(errorMessage, "Error");
}
}
AnswerRe: Datatable to Excel Pin
Dave Kreskowiak12-Jan-17 11:50
mveDave Kreskowiak12-Jan-17 11:50 
GeneralRe: Datatable to Excel Pin
Chris Quinn13-Jan-17 3:53
Chris Quinn13-Jan-17 3:53 
GeneralRe: Datatable to Excel Pin
Dave Kreskowiak13-Jan-17 5:05
mveDave Kreskowiak13-Jan-17 5:05 
GeneralRe: Datatable to Excel Pin
Chris Quinn13-Jan-17 5:07
Chris Quinn13-Jan-17 5:07 
GeneralRe: Datatable to Excel Pin
theoldfool14-Jan-17 16:16
professionaltheoldfool14-Jan-17 16:16 
GeneralRe: Datatable to Excel Pin
Dave Kreskowiak14-Jan-17 16:45
mveDave Kreskowiak14-Jan-17 16:45 
GeneralRe: Datatable to Excel Pin
theoldfool15-Jan-17 2:21
professionaltheoldfool15-Jan-17 2:21 
AnswerRe: Datatable to Excel Pin
Brisingr Aerowing12-Jan-17 12:26
professionalBrisingr Aerowing12-Jan-17 12:26 
QuestionHow to Use Telerik Split button Pin
Member 1293879712-Jan-17 6:38
Member 1293879712-Jan-17 6:38 
AnswerRe: How to Use Telerik Split button Pin
NotPolitcallyCorrect12-Jan-17 8:03
NotPolitcallyCorrect12-Jan-17 8:03 
GeneralRe: How to Use Telerik Split button Pin
Member 1293879713-Jan-17 7:50
Member 1293879713-Jan-17 7:50 
GeneralRe: How to Use Telerik Split button Pin
NotPolitcallyCorrect13-Jan-17 8:25
NotPolitcallyCorrect13-Jan-17 8:25 
GeneralRe: How to Use Telerik Split button Pin
Graeme_Grant15-Jan-17 0:26
mvaGraeme_Grant15-Jan-17 0:26 
QuestionFingerprint and mysql database Pin
King_Eke11-Jan-17 11:26
King_Eke11-Jan-17 11:26 
AnswerRe: Fingerprint and mysql database Pin
Gerry Schmitz11-Jan-17 17:00
mveGerry Schmitz11-Jan-17 17:00 
AnswerRe: Fingerprint and mysql database Pin
Afzaal Ahmad Zeeshan11-Jan-17 23:17
professionalAfzaal Ahmad Zeeshan11-Jan-17 23:17 
QuestionCustom Exceptions - Best Practices Pin
JBHowl11-Jan-17 9:23
JBHowl11-Jan-17 9:23 

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.