Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Pete O'Hanlon21-Mar-11 8:23
mvePete O'Hanlon21-Mar-11 8:23 
QuestionRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Chesnokov Yuriy21-Mar-11 10:06
professionalChesnokov Yuriy21-Mar-11 10:06 
AnswerRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Pete O'Hanlon21-Mar-11 10:42
mvePete O'Hanlon21-Mar-11 10:42 
AnswerRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Chesnokov Yuriy22-Mar-11 0:36
professionalChesnokov Yuriy22-Mar-11 0:36 
GeneralRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Pete O'Hanlon22-Mar-11 0:38
mvePete O'Hanlon22-Mar-11 0:38 
GeneralRe: Windows service stable APPCRASH in clr.dll after 3.5 to 4.0 .NET platform change Pin
Chesnokov Yuriy22-Mar-11 21:52
professionalChesnokov Yuriy22-Mar-11 21:52 
QuestionTotal Dynamic Report. Pin
Dot Net Jantu20-Mar-11 20:26
Dot Net Jantu20-Mar-11 20:26 
AnswerRe: Total Dynamic Report. [modified] Pin
SungBae.Han20-Mar-11 22:43
SungBae.Han20-Mar-11 22:43 
you can read excel sheet in c#

from first cell to end cell...

and you will be insert into generic list from your data.

then you can sorting and searching...

show under code...

it's connect excel ole connect

-----------------
DataTable dtTempTable = new DataTable();
DataTable dtMyTable = new DataTable();
DataRow drMyRow;
int nRowCount = 0;

nRowCount = 0;

strSCell[0] = "A";
strSCell[1] = "1";
strECell[0] = "IV";
strECell[1] = "65536";

if (CommonLib.IsNullString(FileName.Substring(FileName.Length - 4, 4)).Equals("xlsx"))
{
    // strProvider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 12.0;IMEX=1;HDR=Yes;";

    strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=";
    strProvider += (FilePath + FileName);
    strProvider += @";Extended Properties=""Excel 12.0;Imex=1;HDR=YES;""";

    strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}
else
{
    // strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 8.0;IMEX=1;HDR=Yes;";

    strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
    strProvider += (FilePath + FileName);
    strProvider += @";Extended Properties=""Excel 8.0;Imex=1;HDR=YES;""";

    strQuery = "Select * From [Sheet1$" + strSCell[0] + strSCell[1] + ":" + strECell[0] + strECell[1] + "]";
}

OLEDBConnection = new OleDbConnection(strProvider);
OLECommandObject = new OleDbCommand(strQuery, OLEDBConnection);
OLEDBConnection.Open();

if (OLEReader != null)
{
    if (!OLEReader.IsClosed)
        OLEReader.Close();
}

OLEReader = OLECommandObject.ExecuteReader(CommandBehavior.CloseConnection);
dtTempTable.Load(OLEReader);

if (dtTempTable.Rows.Count > 0)
{
    dtMyTable = dtTempTable.Copy();
}

if (OLEReader != null)
{
    if (!OLEReader.IsClosed)
        OLEReader.Close();
    OLEReader.Dispose();
}

if (OLEDBConnection != null)
    OLEDBConnection.Close();

return dtMyTable;


modified on Monday, March 21, 2011 7:01 PM

GeneralRe: Total Dynamic Report. Pin
Richard MacCutchan20-Mar-11 23:23
mveRichard MacCutchan20-Mar-11 23:23 
GeneralI'm sorry :) Pin
SungBae.Han21-Mar-11 13:02
SungBae.Han21-Mar-11 13:02 
GeneralRe: I'm sorry :) Pin
Richard MacCutchan21-Mar-11 23:40
mveRichard MacCutchan21-Mar-11 23:40 
QuestionHandling multiple clients via Sockets Pin
Jacob D Dixon20-Mar-11 9:45
Jacob D Dixon20-Mar-11 9:45 
AnswerRe: Handling multiple clients via Sockets Pin
SungBae.Han20-Mar-11 22:47
SungBae.Han20-Mar-11 22:47 
AnswerRe: Handling multiple clients via Sockets Pin
David198720-Mar-11 23:11
David198720-Mar-11 23:11 
GeneralRe: Handling multiple clients via Sockets Pin
Jacob D Dixon21-Mar-11 16:32
Jacob D Dixon21-Mar-11 16:32 
AnswerRe: Handling multiple clients via Sockets Pin
BobJanova21-Mar-11 23:59
BobJanova21-Mar-11 23:59 
GeneralRe: Handling multiple clients via Sockets Pin
Jacob D Dixon27-Mar-11 5:43
Jacob D Dixon27-Mar-11 5:43 
GeneralRe: Handling multiple clients via Sockets Pin
BobJanova28-Mar-11 11:54
BobJanova28-Mar-11 11:54 
AnswerRe: Handling multiple clients via Sockets Pin
Rob Philpott22-Mar-11 0:39
Rob Philpott22-Mar-11 0:39 
GeneralRe: Handling multiple clients via Sockets Pin
Jacob D Dixon27-Mar-11 5:44
Jacob D Dixon27-Mar-11 5:44 
QuestionEnding all processes including hidden ones Pin
teknolog12320-Mar-11 0:16
teknolog12320-Mar-11 0:16 
AnswerRe: Ending all processes including hidden ones Pin
Dave Kreskowiak20-Mar-11 4:28
mveDave Kreskowiak20-Mar-11 4:28 
AnswerRe: Ending all processes including hidden ones Pin
Eddy Vluggen20-Mar-11 4:38
professionalEddy Vluggen20-Mar-11 4:38 
AnswerRe: Ending all processes including hidden ones Pin
Luc Pattyn20-Mar-11 10:27
sitebuilderLuc Pattyn20-Mar-11 10:27 
Questionsomething very Strange in Webservice and windows-ce connection Pin
Gali197818-Mar-11 21:51
Gali197818-Mar-11 21:51 

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.