.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Persist large dataset across ASP.NET pages. No database

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Can anyone give me suggestions on how to implement the following requirement?

1. A online wizard (step-by step operation) processes user requests across several ASP.NET pages.  The session data is stored in memory until the user submits the request.  Once the request is submitted, a XML file is created and the data are passed to XML.

# Case Study: The parent page has a "select" button.  Click "select" will pop up a child page.  The users can select 1000+ items from a datagrid in the child page.  Once the user clicks "confirm", the selected items in the child page will be populated to the selected item gridveiw in the parent page.  The user can keep selecting more in the child page and the selected items will be appended to the gridview in the parent page.


- What's the best way to extract strings from a text file and convert to a dataset in memory and then present it in a datagrid in UI?

- What's the best way to persist and manipulate a large dataset across pages?  Session? or ViewState? Can it be accomplished by LINQ?

The app doesn't interact with a DB.  Once the request is submitted, it will convert the in memory data to a XML file.  What technology can be used to accomplished this?&nb

View Complete Post

More Related Resource Links

insert new records in tables from dataset to database


I have 2 tables in SqlServer 2008.

Table1: T1id, SomeData

Table2: T2id, T1id, SomeData

I am using DataAdapter.FillSchema to create shema of tables in DataSet. I created DataRelation on columns T1id in both tables.

Now when i try to Update Sql Database T1id in Table2 remains 0 and not the value of T1id in Table1.

I can successfully update Sql Database if i fill DataSet with records first (Using DataAdapter.Fill), but that's not what i want to do. I don't need "old" records in my dataset. I want to use dataset just to store all imputs from user until the proccess is done and then insert all those records "at the same time".

I think i'm getting it wrong with ForeignKeyConstraints, maybe UpdateRule is not set to cascade, i just don't know.

I have been trying to work this out for 6 days now and i'm about to break something on half.

Can someone please guide me to right direction, maybe post some sample, anything.... please!

My old post regarding this:

How to update Sql Server related tables from Dataset(SchemaFill)

SqlDataAdapter.Update related tables

what is large and smal dataset

what is a large and small dataset /.. how can we say that it is large or small data set. can u xplain me clearly. and also send me some dat sets..my mail id is kalyan9029@gmail.com... thanking u .. kalyan

Normalizing Large Database

I need to normalize (if that's the right word) a very wide table with more than 100 million records, turning it into a pair of relational tables. For many variables in the table, there are 20 fields that could be filled in. For simplicity's sake, the table looks like this: JoinID varchar(10) Value1 varchar(8) Value2 varchar(8) Value3 varchar(8) (so on, up to Value20) The way the table is currently set up, if I want to find records where "Value" equals 'x', I need to search across 20 fields. I want to create a table that has one record for each of the 20 Value fields that are filled in, ignoring those that are null. The only way I know to do that is something like below, which can take 20 hours on my table. Is there a more efficient (faster) way to do this? Thanks in advance for any advice. Tom DECLARE @sql varchar(Max) WHILE (@step < 21) USE SANDBOX DECLARE @table varchar(500) SET @table ='Receptacle' DECLARE @step int set @step = 1 BEGIN SET @sql = ' USE SANDBOX INSERT INTO ' + @table +' ( JoinID, Step, Value ) SELECT JoinID, ' + CONVERT(varchar(2),@step) + ' as Step, Value' + CONVERT(varchar(2),@step) +' as HCFPCL FROM SANBOX.dbo.TABLE WHERE VALUE' + CONVERT(varchar(2),@step) +' is not null ' EXEC(@SQL) SET @step+=1 END

dataset not saving to database - what am I not doing? :((

Hello.  Please help me with this one if you have a few mins.  I think I'm overlooking something silly... I have a "hello world" database project.  A mdf database with 1 table "users", the table has 2 columns userid & username (both varchar(50)).  I added a dataset called Database1Dataset.xsd.  I drag the table onto it and it creates the "users" datatable.  I checked it to see if it created the insert and update commands and it has.   On my form I have 2 buttons, one for read and the other for write/save. The read button works and I can see the test records in the database; Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim da As New Database1DataSetTableAdapters.usersTableAdapter Dim dt As New Database1DataSet.usersDataTable da.Fill(dt) For Each dr In dt TextBox1.Text += dr.userid & " - " & dr.username & vbCrLf Next End Sub   The second button should add a new record and save it down to the database but this does not work.  Somehow the changes are not being commited and saved. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim dt As New Database1DataSet.usersDataTable

DataAdaptor/Dataset problems when no row present in database tables

Hi All, I'm trying to use a DataSet to maintain some rows for a table, and when I've finished my changes, send all changes to the database using a SqlDataAdapter.    I find if there are no rows in the table in the database then I am getting a 'Object reference not set to an instance of an object' when I try to access the table in the Dataset. Is there a way to work with a Dataset like this ie. I start off with an empty table and I wish to add rows, to access the structure of the table rows, build rows, then add them and do the update on the SQLDataAdapter. Thanks, Sinead Here is my code: protected SqlDataAdapter memberDA = new SqlDataAdapter(); protected DataSet memberDS { get { if (ViewState["memberDS"] != null) return (DataSet)ViewState["memberDS"]; else return new DataSet(); } set { ViewState["memberDS"] = value; } } protected SqlDataAdapter getDataAdapterForMembers() { SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["SiteDBConn"].ConnectionString; memberDA = new SqlDataAdapter("usp_GetMembers", conn); memberDA.SelectCommand.CommandType = CommandType.Stored

problem in Transferring a large dataset to remote machine by using the NetTcpBinding

i am developing an WCF application, in which i have to transfer a large dataset to the remote machine!! for that im using nettcpbinding in WCF but i got this exception ' The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10:29:59.4140000'. at my sender side.   Sender/Client side code   // Object for sending to remote client using (_dpParameters = new DPParameters()) { _dpParameters.SequenceFieldName = "Sequence"; _dpParameters.Size = 10; _dpParameters.SubjectsForFiles = "S,Y,T"; _dpParameters.SubjectNames.Equals(SubjectNames); _dpParameters.FilePath = " E:\\Source\\Phospho.xml"; // this dataset can be in GBs but for testing me using jst 6.78mb DataSet ds = new DataSet(); ds.ReadXml(_dpParameters.FilePath); _dpParameters.Usd = ds.Tables[0]; } /// This is the binding settings NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.ReceiveTimeout = new TimeSpan(10, 30, 00); tcpBinding.SendTimeout = new TimeSpan(10, 30, 00); tcpBinding.MaxBufferSize.Equals(67108864); tcpBinding.MaxBufferPoolSize.Equals(67108864); tcpBinding.MaxReceivedMessageSize.E

non-exixstent html pages persist and won't die and can't be exterminated


I'm having a rather odd problem with html pages in VWD.

I'm using VWD 2008 Express on my personel home computer with windows XP as the operating system and  developing aplications using  my home computer as the local server.  Also have a web site  server..... but thats not where the issue arises now.

Problem is, when i create a new html page,  a blank page  with typing only on the page, say:

"this is a html page"

save the page with only the above phrase on the page, I can't go back and make any changes to the page.  If i do, no matter how simple the change , all that displays is the original typing.  I also cannot modify or change  any of my much more extensively developed web pages. 

Even  the simplest addition or changes  all lead to the same  result  when I use  View in Browser or use the Start debugging option VWD ignore what ever i did and displays the original HTML  content.

However if I open up the same page using IE or Mozilla Browsers, or upload the HTML page to my webhost server it shows all the changes i made.  So the problem is entirely inside VWD.    Only when i try to view the page in VWD does it appear as if no changes were made, IE/Mozilla show the changes made.

Furthermore this only happen

retrieve large file from database ?


I have a database table that works as a file repository.  Currently there are binaries stored in there and I want to pull the "large" ones out in chunks.  Some of these files are in excess of 500 MB.  I have business rules that dictate if the file is >5MB to transmit in chunks.  <5MB and I can load into memory and rip out.  I got the uploading in chunks to work, but how do I get it to pull it out of the DB in chunks?

Right now I'm getting hit with a 'System.OutOfMemory' exception.  But when I recreate the byte array of the SAME size (empty though) it doesn't break.

Download Chunks (DAL)

public byte[] getBytesByDataID(int chunkSize, string dataID)
            string query = "SELECT data.data " +
                " FROM data " +

creation of multiple .aspx pages from database name


 hi ,
i am making an internal social networking application for my small organisation where i work  .i have a list of all employee  names in a mssql 2000 database that are the names of 5000 employees of the company  one by one arranged in rows in a single coloumn of a table . i have a folder ,i want to make  .aspx files/pages in that folder ,the file name should be same as names of the person in database coloumn.can any help me with codes to automatically make the .aspx pages with the same names as it is in database coloumn.(note that folder will not take any duplicate values(name will not be repeated)) .i am making application using asp.net 2.0.file will be automatically created in the folder as soon as new name is entered in database.its very difficult to make 5000 aspx page with each employee name and it will be difficult to make new pages again and again after new employees names are entered.so i want that files will be automatically created after employee names are registered.  

thanks in advance.

hoping for help for someone.

Sending Large Dataset to Webservice


Dear all,

I have one problem is that when i send large dataset containing byte array.. then webservice not respond well..

it shows error like underlying connection was closed...

I mark that when dataset size goes some large then only problem occurs otherwise it works well..

Please give me solution of how to send large dataset over web service...



Large Dataset Downloaded Before Rendering Report's First Page



I'm hoping to understand the behavior of SSRS a bit better in the following scenario (SSRS 2008).  A single matrix (tablix) exists on the report.  No other objects are on the report.  That matrix is populated with 1.1 million rows of data totaling about 200MB.  Why does SSRS download the entire dataset prior to rendering the report's first page or am I missing something here?

When previewing the report, the local .data file bloats to 200MB indicating all dataset rows are being returned.  The matrix does not contain any sorting, all cell "can grow" and "can shrink" properties are set to false, no expressions are used anywhere, and even the table's column data types from which the data is being pulled are appropriate.  In other words, I believe I've reduced storage and CPU needs while eliminating elements that add overhead when rendering a report.

The specific scenario here is a researcher previewing the first few pages of data then choosing to download the entire dataset.  MS documentation I've read refers to "soft page breaks" when rendering as HTML and left me with the impression that perhaps SSRS needs to know the entire height of the dataset before it'll slice the report into pages.  It's odd to me though that it needs to download 1.1 millions rows of data befor

Importing large dat file into sql server database

I have a dat file which consists of thousands of columns which i have to insert into a database. I have to insert the data into multiple datatables. I am looking for the best possible way to do that. I have looked into bulk insert also but is there a better way? something like normalizing the data in the data access layer and inserting into the tables or creating ssis packages? Any help is highly appreciated.

ReportViewer Control large dataset timeout


Reporting Services 2008 R2

I have a rather large report that returns around 40,000 records. (I've tried telling the business that this is not a useable report and no one is listening.)

When I execute the report through a webservice and stream it to an excel file the response time is fine.  Trying to load the report using the report viewer control it just hangs.

When I run the report through SSRS own Report Manager, I get the following error

  • An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database. (rsReportServerDatabaseError)
    • Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.



This is on my own local dev machine at the minute and I've only just gotten the correct dataset it will be run against.

The stored proc runs in a couple of seconds.

Does anybody have any suggestions in what I can do?

Any help would be appreciated.



-----  Code

<rsweb:ReportViewer ID="WebRep

Large geo database (not spatial), index problems




I am have trouble getting my database selects fast. The SQL force is not strong with me.

The data is provided from geonames.org and contains about 8 mio locations.

The main problem is my ORDER BY population DESC. When covering a large location, where there are lots of populated places (pp), its fast, but when covering the sea, 0 pp, its really really slow.


Here is the table:

CREATE TABLE [dbo].[GeoNames](
  [geonameid] [int] NOT NULL,
  [name] [nvarchar](200) NULL,
  [asciiname] [nvarchar](200) NULL,
  [alternatenames] [nvarchar](max) NULL,
  [latitude] [float] NULL,
  [longitude] [float] NULL,
  [feature_class] [char](2) NULL,
  [feature_code] [nvarchar](10) NULL,
  [country_code] [char](3) NULL,
  [cc2] [char](60) NULL,
  [admin1_code] [nvarchar](20) NULL,
  [admin2_code] [nvarchar](80) NULL,
  [admin3_code] [nvarchar](20) NULL,
  [admin4_code] [nvarchar](20) NULL,
  [population] [bigint] NULL,
  [elevation] [int] NULL,
  [gtopo30] [int] NULL,
  [timezone] [char](31) NULL,
  [modification_date] [datetime] NULL


My clustered index:

CREATE UNIQUE CLUSTERED INDEX [pk_lat_lng_id] ON [dbo].[GeoNames]
  [latitude] ASC,
  [longitude] ASC,
  [feature_class] ASC,
  [geonameid] ASC,
  [population] DESC

Master Data Deletion in Large Database Applications


I am working on School MIS application and apparently, it has many Master profiles, like School, Student, Class, Division, Employee etc. In order to keep my database integrated and to maintain the consistency of data whenever someone deletes a master data then everything related to that data also gets deleted.

However, as the application is progressing I am wondering if it is a right way to do it because when someone deletes a master data then there is hell lot of data which would also get deleted. And the related data which would get deleted would in turn have other related data.

So if in my application if someone would delete a school then all the information related with a school like Students, Classes, Sections, Division, Employees should also get deleted and Students in turn would be associated with other data which should also get deleted.

I was wondering what would be the best approach? What if someone deletes a master record it by mistake, though we would take the confirmation before deleting but if by any chance someone does it by mistake then it would cost the organizationa lot:)

1) Should we really provide a feature to delete a data or when user tried to delete a data then maybe we can deactivate it and all other related data by setting some flag in the table.

2) If we have to delete the data then, should we just take confirmat

Create a XML file from Database table using Dataset



I've got a SQL database with a table named contact with different column such Name, Address, email ...

I would like to generate a XML file based on the table data:


     <name> John</name>

    <address> 100 main street </address>



After some research it looks like I can use a dataset from that table to create my xml.

Being a beginner I cannot find the right steps / syntax to do so.

Is there any tutorial showing how to work with dataset and XLM?

Thank you for your helps 


create sql server database based on the dataset c#


Hi all,

I am reading xml file using dataset.readxml() method. . . after this i want to send this data to the database. I want c# code to create a database in sql sever and push watever data in the dataset to that created database.... i am dealing with many xml documents... some could be of same format.. lets say... if 2 docs of same format exists... then it shud not create new database or new tables.. it shud push the data to the suitable format...as i am a newbie its a bit confusing for me... i dont even have any idea on how to proceed with this... please reply if you know the answer for any part of the requirement... any help is very much appreciated..




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend