Page Cannot Be Found - DNS Error

J

jimmyrose

Ive searched and searched but can't find anyone with a similar problem
to mine. Ive made a web form that just enables you to choose a period
in DateTime, and filter by certain categories once the sql data has
been returned. it all works fine until I request a month or more of
data (30000 records). The page updates, returning the info in a
scrollable datagrid, but then i cant click anything, not even buttons
that dont request any info. one button only togggles some text
visible/hidden and that even causes the DNS error.
ive had plenty of experience with visual studio and c++ etc, but ive
never done any web publishing like this so I'm stuck.
i was thinking maybe there is a way to store all the data from the
first request in memory and then have the buttons/drop down lists only
effect that info, so the server is only contacted every time the period
is changed. is this possible?
any other ideas?
thanks
_________
James
 
S

sloan

I would try 1 of 2 things.

1. Use a IDataReader. As opposed to NOT using a DataSet. IDataReaders are
"fire hose" , in that you read 1 record at a time, then you move to the next
one.

2. If your page has any sort of "re-accessing" the data, to filter, sort,
etc. then Create a MyObjectCollection : CollectionBase (implements
CollectionBase)

and use an IDataReader to populate

Where you create another object called

public class MyObject

private string m_name;

public string Name

{ get { return this.m_name; }}

public MyObject (string n)

{ this.m_name = n; }

you will get an IDataReader

as you loop over the IDataReader, you will create a new MyObject, and then
add it to MyObjectCollection

You'll have to do a little more research on using IDataReader and
CollectionBase, but the overhead of this is smaller than using a DataSet.

...
 
J

jimmyrose

Thanks,
Ok i researched the IDataReader and CollectionBase and I think I know
how to implement them, but I don't know how to filter the
collectionbase once i have all the data in there. do i have to make
another collection called DisplayCollection and look at all the records
in the original one to pick out the ones i want based on a filter
string? or is this built in somehow. is there any way i could just
query the collection? that would make things much simpler.
 
B

Bruce Barker

your problem is your page html is too big. for IE to render 30,000 table
rows is a long time. you are trying to post before all the html has
rendered.

you should switch to a paging table/grid, (also carefully control the
viewstate usage of a grid). you can use session to store a dataset of the
query, and rebind to it. or write a paging query where only the page is
loaded into the dataset.


-- bruce (sqlwork.com)
 
S

sloan

Ok..

You're almost there:

now, your CollectionBase (your implementation), will need to add a .Sort
method.

the .Sort method takes an IComparer object. You create your own IComparer.

Here is a sample. Assuming you already have an object called Employee, with
2 properties
public int Age
public string Name


namespace MyApplication.BusinessLogicTier

public class EmployeeComparer : IComparer
{
private EmployeeComparerSortColumns m_sortValue;

public enum EmployeeComparerSortColumns
{
None = 0 , Age = 1 , Name = 2
}

public EmployeeComparer(EmployeeComparerSortColumns sortValue)
{
m_sortValue = sortValue;
}

public int Compare(object x,object y)
{
switch(m_sortValue)
{
case EmployeeComparerSortColumns.Name :
case EmployeeComparerSortColumns.None :
return
((MyApplication.BusinessLogicTierEmployee)x).Name.CompareTo(((MyApplication.BusinessLogicTierEmployee
)y).Name );
//break;

case EmployeeComparerSortColumns.Age :
return
((MyApplication.BusinessLogicTierEmployee)y).Age.CompareTo(((MyApplication.BusinessLogicTierEmployee)x).Age
);
// break;



default:
return
((MyApplication.BusinessLogicTierEmployee)x).Name.CompareTo(((MyApplication.BusinessLogicTierEmployee)y).Name
);
// break;
}
}
}

}


Ok, your CollectionBase object will have a .Sort method.

MyCollection.Sort (IComparer ic) // it may be "override", I'm going from
memory.
{
this.innerList.Sort(ic);
}


Notice you call the base class' Sort method.


Then you do something like


MyCollection my = new MyCollection();
my.Add ( new Employee() );
my.Add (new Employee() );


EmployeeComparer ec = new EmployeeComparer
(EmployeeComparer.EmployeeComparerSortColumns.Age);
my.Sort(ec);


I think those are the pieces.
The way I wrote the EmployeeComparer , means you don't have to write a
different one for each property, because you have an enum in the
constructor. A tad bit cleaner.


...


I am suggesting this route for 2 reasons:

Less overhead than the DataSet. Everybody likes to use/suggest datasets,
because they're quick. However, there isn't magic fairly dust, because they
do so much, they have alot of overhead with them.
Using the IDataReader ... and putting that into a CollectionBase, is alot
less overhead. (It may not seem that way, but populating a custom
CollectionBase is about 30% faster in my personal tests).

#2, you can cache a true CollectionBase (filled with MyObject's) alot better
than a DataSet.

Because of your large number of records, OVERHEAD is your biggest enemy.
I'm not even saying this way will definately work. I'm saying it has a lot
better chance that a DataSet.



After you get working, then you may want to add the
[Serializable]
attribute to your MyObject definition, and your MyCollection objects.

(it looks like this in C#
namespace MyApp
{
[Serializable]
public class MyObject
{
}
}



What you're doing here is more work, but you pay the price for less
overhead.


...


PS

You should also keep your ( IDataReader to MyCollection ) converter code
generic, in its own routine. Thus you can re use it.

Something like:


public MyCollection TransformTheIDataReaderToMyCollection (IDataReader idr)
{

MyCollection returnColl = new MyCollection();

while (idr.Read()) // my syntax might be a little off here, I'm going from
memory.
{
MyObject o =new MyObject();


if( !idr.IsDBNull( 0 ) )
{
o.Age = idr.GetInt32(0);
}
if( !idr.IsDBNull( 1 ) )
o.Name = idr.GetString(1);
}

returnColl.Add ( o );

}


return returnColl;

}

This way.... you can populate your IDataReader with
All Records (no filter)
Some records ( filters applied , like "Age = 34" in your Select query)
1 record ( Where Emp.EmpId = 12345 )

...

Ok.... I think that should help.


You're writing some more advanced code than just populating a DataSet.

As you become more famaliar with CollectionBase , it may turn into your
bread and butter for object storing.
Especially with the generic TransformTheIDataReaderToMyCollection method.

One last thing:

Where I have:

if( !idr.IsDBNull( 0 ) )
{
o.Age = idr.GetInt32(0);
}

You probably want to put in a CONST or some kind of enum or structure for
"0", to make the code more readable.

private readonly int CONST_AGE_COLUMN_ORDINAL_POS = 0;

if( !idr.IsDBNull( CONST_AGE_COLUMN_ORDINAL_POS ) )
{
o.Age = idr.GetInt32(CONST_AGE_COLUMN_ORDINAL_POS ) ;
}



You check out some other hints at my blog at:
http://spaces.msn.com/sholliday/



As the other guy suggest, implementing Paging ( Page1 , Page2 ,..... PageN)
might be something to look at.
While he suggests caching the DataSet object, I would still promote the
MyCollection idea.

If you want to find a cool web caching mechanism, check out my 10/24/2005
entry on my blog.

...
 
J

jimmyrose

wow thanks. all that was a bit hard to take in, but i might give it a
go, except that it will probably take too long to implement. this page
wasnt meant to be something really advanced, just a quick way to filter
through site-wide alarms. i was thinking last night i could simply just
do a count before the query, and see if theres more than 5000 records
show a label saying "Not all data displayed - narrow the search" and do
a TOP 5000 query. i dont think anyone is going to want to scroll
through 30000+ rows of data, they can just use the damn filters, thats
what theyre there for.
but thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top