DataSource Controls :: Reading With DataReader Into List And OutOfMemoryException
Sep 23, 2010
I'm Using a DataReader to Read about 100,000 records, my code look like :
[Code]....
I have a per row computation in reading the rows on GetMyType2Info() method, and this method also another method that I return only one record by ExecuteReader(). the problem is that when the MyTypeList (List<T>) has about 21,000 Items of MyType (<T>) System.OutOfMemoryException is thrown. wanted to know how to resolve this and wanted to know more about the maximum size of List<T> capacity. in addition the execution of the main Query with 100,000 records take about 4 seconds in SQLServer a record has only types of nvarchar , float,datetime and int
View 1 Replies
Similar Messages:
Jul 8, 2010
I'm trying to read data from a text file into a DataReader object using the following code but I get an exception:
OleDBException was unhandled.
Cannot update. Database or object is read-only.
Also, I would like to know if it is efficient to read data of a text file into a datatable instead of using StreamReader object and traversing through the recordset.
[Code]....
View 3 Replies
Oct 19, 2010
I have a table with just a column and a row in a table that it save just a file with size 1.5 GB ! C# application and sql server are in different machines. I want to read that file by DataReader every 100 MB then save all 100 MB files to disk by "FileMode.Append" for file stream and collect them to one file.
View 1 Replies
Apr 1, 2010
I am trying to run a script to build a database structure for open source app nopcommerce. When I try to run the script via sql management studio I receive and error (below). I am running sql express on the hosting server. I also have issues connecting via management studio directly to the sql server installation, but am able to connect via remote desktop. I dont know specifics about the installation since I was not the one to install it.
View 1 Replies
Jan 25, 2011
- i have two drop down lists- ddl_SelectClient, ddl_SelectApplication
- when a client is selected in ddl_SelectClient, i have to show the list of the clients applications in ddl_SelectApplication
- i have written the below code in the ddl_SelectClient_SelectedIndexChanged routine to do the same
- i am getting the error("Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack") in the catch block when the ddl_SelectApplication gets binded
[Code]....
View 3 Replies
Mar 29, 2011
I have put a SQLDataSource on my page and everything is adjusted and it works properly. I read an article
here which was indicating that you can use a DataReader in order to get data from sqldatasource, but it doesn't say how, the only thing that is said is to use DataSourceMode property in order to adjust it for a DataReader.
View 1 Replies
Apr 21, 2010
How do I load a datareader in a defult.aspx page using while using a database connection that is defined in the web.config file?
View 3 Replies
Sep 11, 2010
why this first connection works but the second doesn't?
[Code]....
I'm trying to use <asp:FileUpload> to upload images and as far as I know you have to use <asp:SqlDataSource> to do it but I need to create the connections string using entries stored in a database.
View 2 Replies
Jun 28, 2010
Dim sqlc1 As New SqlCommand("sp_navmenu 275,1,21", ERIKSDbCon)
View 4 Replies
Aug 24, 2010
When a sql query returns NULL , I can use the following code to evaluate:
[Code]....
When a sql query returns nothing, neither IsDBNull nor is Nothing works. I don't know why some sql queries return null while some return nothing when there are no data returned. But anyway, can somebody tell me how to evaluate nothing value returned in sql datareader in vb.net? When I put the cursor over signInfo variable in debug mode, I can see Nothing show as its value. But the line does not work
[Code]....
View 3 Replies
May 11, 2010
Any one can suggest a method to convert Datareader to dataset or any alternate method
View 7 Replies
May 17, 2010
dataTable with dataReader not working
[Code]....
View 3 Replies
Feb 1, 2010
I would like to loop through my result set and generate a menu structure like this:
pagetitle
pagetitle
subtitle
subtitle
pagetitle
pagetitle
So far I have the following code but it doesn't generate the menu?
While reader.Read()
' set title
sitetitle = reader.Item("siteName")
mydata &= reader.Item("pagetitle")
' check subtitle exists, if so, build menu, loop though subtitles somehow?
if not IsDBNull(reader.Item("subtitle"))
mydata = "<ul>"
mydata &= "<li>" & reader.Item("subtitle") & "</li>"
mydata &= "</ul>"
end if
End while
Qeury and result set below:
sql:
SELECT subpages.subpageid, pages.pageid, sites.sitename, sites.siteid, pages.siteid,pages.pagetitle, subPages.subtitle FROM pages LEFT JOIN sites ON pages.siteid = sites.siteid LEFT JOIN subpages ON subpages.subpageid= pages.pageid WHERE sites.siteID = 1 ORDER BY sites.siteid, pages.pageid, subpages.subpageid ASC
results:
subpageid | pageid | siteid | siteid | pagetitle | subtitle
NULL 1 SCHS 1 1 Sandwell Community Healthcare Services NULL
NULL 2 SCHS 1 1 About Us NULL
NULL 3 SCHS 1 1 Your Services NULL
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 1111
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 2222
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 333
4 4 SCHS 1 1 Equality and Diversity Team at SCHS 44444
NULL 5 SCHS 1 1 Single Equality Scheme NULL
NULL 6 SCHS 1 1 Diversity Strands NULL
NULL 7 SCHS 1 1 Equality Impact Assessments NULL
NULL 8 SCHS 1 1 Quality and Safety Committee NULL
NULL 9 SCHS 1 1 Contact Us NULL
View 5 Replies
Mar 16, 2010
I have used SqlDataReaders a million times. Someone, what is wrong with this code:
SqlConnection connection = new SqlConnection(connectionString);
try
{
connection.Open();
SqlCommand command = connection.CreateCommand();
[Code]....
I have checked this against similar classes and it is exactly the same, but this one doesn't work.
View 4 Replies
May 27, 2010
protected void Page_Load(object sender, EventArgs e)
View 7 Replies
Feb 25, 2010
I have text field on a sql server table and I retrieve it on string variable using datareader : string result = reader["MyTextfied"] but I have this errors ( text or binary field cannot be troncated ) My text fied contains a large of text
View 5 Replies
Mar 25, 2010
i have a datareader who read from data field from sql server, this field is datetime format now, when this field is null it returns 01/01/1900!! how can i manage it without if or some check, is there a property in datareader or sqlserver properties who i can return null value from datetime field?
View 4 Replies
Apr 16, 2010
I use a SqlDataReader to get fron sqlServer a row af a table. This table have a text field where I store a Xml configuration. In one case this Xml grow up to 650Kb. When I get the field from the datareader it cost amost 2 seconds:
INFO 2010-04-16 09:46:40,559 [12] Cms.dataContenido - readed
INFO 2010-04-16 09:46:42,356 [12] Cms.dataContenido - XMLContent
This is my code:
[Code]....
View 1 Replies
Jun 2, 2010
This is the code i am used for fetching data from DB2 server (windows based server)In the same server tables created by me is working fine...eg:
oCommand.CommandText = "SELECT * from DEB.TESTUSER";
below is a table created by another application but the data reader is not working with this query ( table in the same server with same DB as above)
oCommand.CommandText = "SELECT * FROM DEB.RULE_GROUP";
If any permission or any other things i want to check .....i mean security related.....odbcadapter is also working fine....pls help regarding the datareader.....below is the complete code......
private void btnSelectRecord_Click(object sender, EventArgs e)
{
OdbcConnection oConnection = null;
[code]...
View 3 Replies
Feb 17, 2011
In C#.I have a list<object>.
I want to convert any datareader result (with data) to a list of objects.
How can I do that?
View 6 Replies
Feb 26, 2010
I don't know how to read data into variables from a SELECT query. I can add, update, and delete queries with no issues. I have browsed a few books, but everyone uses a different approach. Suppose I want to to run a query and 1 record is returned. How do I get the values into my variables.
Suppose my table name is "Job Orders", and the row returned has these 3 fields:
JobNumber, FirstName, Lastname
[Code]....
[Code]....
this is where I go blank ?
"I learn by doing, not by reading"
View 1 Replies
May 16, 2010
I would like to check my database for to see if a user name is available but my script isn't working.
I am taking input from a text box call unametextbox and i'm trying to extract any matching username from the database, this is my code.
[Code]....
View 8 Replies
Apr 27, 2010
I have a C#/Asp.net web application which caches SQL DB schema information. Is there a way that I can determine what child relationships a given table has? I have looked into using the DataTable.ChildRelations property, but it is never populated with items unless i manually create a relationship using the .add property. I also have access to DataColumn information for each column in the database.
View 4 Replies
Feb 23, 2010
I am using MS SQL Server 2005 and i added "" to my connection string and i still have the problem
"There is already an open DataReader associated with this Command which must be closed" ;
SqlDataReader dr2;
StrSql = " SELECT * from Modules";
cmd.Connection = conn;
cmd.CommandText = StrSql; [code]....
View 1 Replies
Sep 22, 2010
I'm trying to store multiple selected checkboxes from a single checkboxlist, but i don't know where to start. Imagine i have three tables: tbl_events, tbl_organisors and tbl_settings and i want to store the organisors of an event. Each event can have multiple organisors, so each organisor should be added as a single row into tbl_settings. I know how to bind tbl_organisors to a checkboxlist, but how do i store the results (meaning: add the rows to tbl_settings) ?
tbl_events: Event_ID (PK) and Event_Name
tbl_organisors: User_ID and user_name.
tbl_settings: Settings_ID (PK), Event_ID and User_ID
Checkboxlist:
[Code]....
SQLDatasource:
[Code]....
Initially all checkboxes will be unchecked, but users must be able to select multiple organisors from the checkboxlist and then store them into the DB by submitting a form. So the query will look something like: INSERT INTO tbl_settings (user_id, event_id) VALUES (@user_id, @event_id). And this is where my head cracks
1) How do i loop through all selected checkboxes and store each value (user_id) in a new row in tbl_settings?
2) After saving, the users reloads the page and the organisors he just selected must be selected by default in the checkboxlist. How?
View 2 Replies