Generate Text File

Generate Text File

Old forum URL: forums.lhotka.net/forums/t/4653.aspx


vijay posted on Wednesday, April 09, 2008

Hello,

I am new to the using CSLA and need some help. My requirement is i have to open cursor from database and going through the loop i need to generate a file (.xls) and show the link on .aspx page to download/open the file. I am using VS 2008 with CSLA. Can someone guide me how should i start with. Thanks.

sergeyb replied on Thursday, April 10, 2008

CSLA does not have ability to create XLS files.  You will need a third part product to do so programmatically or use Excel.Application (not good).  I think, ComponentOne has .NET excel library.  In any case, create CSLA read-only base and read-only list base classes, populate them from data reader, then loop through items in the list, populating data in Excel spreadsheet.

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: vijay [mailto:cslanet@lhotka.net]
Sent: Thursday, April 10, 2008 12:47 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Generate Text File

 

Hello,

I am new to the using CSLA and need some help. My requirement is i have to open cursor from database and going through the loop i need to generate a file (.xls) and show the link on .aspx page to download/open the file. I am using VS 2008 with CSLA. Can someone guide me how should i start with. Thanks.



vijay replied on Saturday, April 12, 2008

Thanks Sergery for your reply.

So what i understand is, i have to follow these steps to generate a text file:

1. I have to open the cursor and write to the file do i need to create object for ReadOnlyChile. Can't I pass SafeDataReader to application from ReadOnlyListBase. Would it possible if you can provide some code or link where this is implemented.

2. On same screen i need to open 14 different cursors and generate the file. Is there any way so that i can resuse the objects or i need to create seperately for all cursors. Thanks.

sergeyb replied on Saturday, April 12, 2008

1.       You can create ReadOnlyList and use data reader to populate it.  Then you can scroll through the list, writing data to a file.

2.       If files contain different data, you need to create a separate ReadOnlyList for each one and use different command to populate it with data.

 

Depending on requirements, I am not sure if you need the ReadOnlyList or you can just use custom objects to write the data out

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: vijay [mailto:cslanet@lhotka.net]
Sent: Saturday, April 12, 2008 8:17 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: Generate Text File

 

Thanks Sergery for your reply.

So what i understand is, i have to follow these steps to generate a text file:

1. I have to open the cursor and write to the file do i need to create object for ReadOnlyChile. Can't I pass SafeDataReader to application from ReadOnlyListBase. Would it possible if you can provide some code or link where this is implemented.

2. On same screen i need to open 14 different cursors and generate the file. Is there any way so that i can resuse the objects or i need to create seperately for all cursors. Thanks.



Copyright (c) Marimer LLC