C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

File Splitting in


Posted Date: 04 Nov 2009      Posted By: ramesha      Member Level: Bronze     Points: 1   Responses: 1



Hi Friends
I have a cummulative excel file with me. Once i click on split button the cummulative files should be split at runtime according to the date column in the cummulative file. According to the date the files should be split into individual text file.

Thanks
Ram





Responses

Author: Praveen    04 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,

read the excel data in to a datatable

let say DataTable dtOriginal is the Original Table

let say dtCopy is the Copy of the Original Table


private void SampleCode(DataTable dtOriginal)
{
DataTable dtCopy=new DataTable()
foreach(DataColumn dc in dtOriginal.Columns)
dtCopy.Columns.Add(dc.ColumnName,dc.ColumnType);
DataRow[] drSelect=null;
RepeatProcess:
if(dtOriginal.Row.Count>0)
{
drSelect=dtOrignal.Select("Date="+dtOrignal.Rows[0]["Date"]+");
foreach(DataRow dr in drSelect)
{
dtCopy.ImportRow(dr);
dtOriginal.Rows.Remove(dr);
// write code to create text File
}
goto RepeatProcess;
}
}


hope that will give you an idea



Post Reply
You must Sign In to post a response.
Next : Message Box
Previous : URL in JPEG file
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use