DataSource Controls :: Almost 2 Seconds To Read A Datareader Field
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
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
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?
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.
I have a issue im trying to get though where my site while up useing a ajax timer ever 15 seconds to update there time stamp to say there still online and active. Its the best way i could think of to handle the are they online/did they just leave issue i was having. Any ways i dont know how to query the database with linq to sql so i guess i will do psudeo code like stuff and hopefully some one can offer some advice.
I always thought we had to use a DataReader or a Dataset to read a given SQL data but i realized that it is not necessary to use them to read an SQL Output Parameter(im not a SQL expert).
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.
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
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
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
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......
I am getting the following error when i am trying to assign values to controls on form via datareader, i know i got one row. but this particular field has no data in it.
I do have lot of other forms where i use the same style
getting this error: invalid attempt to read when no data is present
on this line: If gDatareader("CutoffDate") Is DBNull.Value Then
i am implementing a update query module.i am displaying all fields from a table for a term searched. well now i am implementing update option for the record which are displayed, i have like 70 columns in my table, and i want to know how to restrict some selected fields to be only read only while the form can be updated ?Like if user select to update a record then some selected field such as "Timestamp, UID etc some selected fields" remains READ ONLY !
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.
first of all, sorry if my title isn confusing as i dont really sure the specify description regarding what i wan to do. Now what i trying to do is, I getting 5 random images from the database, this is the code for me to get random 5 records from database:
[Code]....
I dont really know how to use array but willing to try if it is needed.
I have a 20 to 30 fields on a form. Most of them are optional. However, the users can fill out what they want. If a user dosen't fill in a field when data is sent to the database it's sent as blank, instead of NULL. Is there a way I can generically say "for all textboxes if Equals("") then DBNull.Value". Without going through each and every textbox?