DataList, Repeater, or Data Grid?

N

.Net Sports

I am resurrecting an old script from a previous programmer, and want to
migrate it over to asp.net from classic asp. Tho there are other
peripheral parts of the script (that really have no bearing on the
core, in which I will explain), the main core is the concern. I have a
daily feed from a horseracing prognosticator that gets put into an sql
database on a daily basis for roughly 15 popular racetracks. A user
(who will need a usern/password) will come to a page that lists the
tracks available for that day, click on a link for a track, and will
come to the page and script in question. From the database will be data
from 3 different tables: tblRace (the # of race for that day, the
racedate the trackID, other auxiliary info like track length, horse
ages for a race, ), tblTrack (trackname, trackID) , tblHorseentry (the
horses name, the gate position, speed rating, other aux info) .
tblHorseentry has a raceid, relational key with tblRace, and a trackid
is in relation with tblhorseentry and tbltrack. Below is the SQL
statement:
'''sql stmt'''
<% sqlstr ="SELECT
tblhorseentry.horsename,tblhorseentry.gatepos,tblhorseentry.bestbet,tblhorseentry.topplay,tblhorseentry.rating,tblhorseentry.speedpr,tblrace.raceid,tblrace.racedate,tblrace.raceno,tblrace.racelength,tblrace.raceturf,tblrace.racedescription,tblrace.horseage,tbltrack.trackname
FROM tblrace INNER JOIN tblhorseentry ON tblhorseentry.raceid =
tblrace.raceid INNER JOIN tbltrack ON tblrace.trackid =
tbltrack.trackid WHERE trackname = '" &
request.querystring("trackname") & "' and racedate = '" &
request.querystring("racedate") & "' AND raceno = 1 AND rating = 1;" %>

The problem here is at the end, where along with the querystrings
bringing over the trackname and racedate, this sqlstring will bring up
just the horsesname and auxiliary info for just the first race, and if
he is the favored horse (rating) for this particular race by
information compiled by the horseracing handicapper. I need to find a
way to grab all the racenumbers (raceno) and ratings in an array and
somehow loop thru the array until the end of the recordset (asp) or
dataset (asp.net).

With those obstacle in mind, how can I start to set this up in asp.net.
Will a DataList that just templates everything out, or a Repeater
control be best, or will even a DataGrid control encompass everything I
need to accomplish?

Thanks for any input

E.M.
..Net Sports
 
I

IPGrunt

Subject: DataList, Repeater, or Data Grid?
From: ".Net Sports" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet


I am resurrecting an old script from a previous programmer, and want to
migrate it over to asp.net from classic asp. Tho there are other
peripheral parts of the script (that really have no bearing on the
core, in which I will explain), the main core is the concern. I have a
daily feed from a horseracing prognosticator that gets put into an sql
database on a daily basis for roughly 15 popular racetracks. A user
(who will need a usern/password) will come to a page that lists the
tracks available for that day, click on a link for a track, and will
come to the page and script in question. From the database will be data
from 3 different tables: tblRace (the # of race for that day, the
racedate the trackID, other auxiliary info like track length, horse
ages for a race, ), tblTrack (trackname, trackID) , tblHorseentry (the
horses name, the gate position, speed rating, other aux info) .
tblHorseentry has a raceid, relational key with tblRace, and a trackid
is in relation with tblhorseentry and tbltrack. Below is the SQL
statement:
'''sql stmt'''
<% sqlstr ="SELECT
tblhorseentry.horsename,tblhorseentry.gatepos,tblhorseentry.bestbet ,tblhorseentry.topplay,tblhorseentry.rating,tblhorseentry.speedpr,tbl
race.raceid,tblrace.racedate,tblrace.raceno,tblrace.racelength,tblrac
e.raceturf,tblrace.racedescription,tblrace.horseage,tbltrack.tracknam
e
FROM tblrace INNER JOIN tblhorseentry ON tblhorseentry.raceid =
tblrace.raceid INNER JOIN tbltrack ON tblrace.trackid =
tbltrack.trackid WHERE trackname = '" &
request.querystring("trackname") & "' and racedate = '" &
request.querystring("racedate") & "' AND raceno = 1 AND rating = 1;" %>

The problem here is at the end, where along with the querystrings
bringing over the trackname and racedate, this sqlstring will bring up
just the horsesname and auxiliary info for just the first race, and if
he is the favored horse (rating) for this particular race by
information compiled by the horseracing handicapper. I need to find a
way to grab all the racenumbers (raceno) and ratings in an array and
somehow loop thru the array until the end of the recordset (asp) or
dataset (asp.net).

With those obstacle in mind, how can I start to set this up in asp.net.
Will a DataList that just templates everything out, or a Repeater
control be best, or will even a DataGrid control encompass everything I
need to accomplish?

Thanks for any input

E.M.
.Net Sports

E.M.

All of the data list controls that you mention are webcontrols, that
is, they are user interface controls for displaying the data.

The classes that you shold explore are the ones designed for the
backend data tier, within the Data namespace and are referred to in
general as ADO.NET.

First readup on ADO.net in general. Note that Dot Net is designed for
n-tier design practices, so you must understand the conceptual
paradigm.

Thenm get to know the connection and command objects. These are
SIMILAR to ADO, but not exact. The key to returning data from your
sql statement is through the Command object. Since you are dealing
with lists of records, you'll next need to understand the objects
that model a view in your application.

In ASP, we used an ADORecordset. No such thing in ADO.NET. What we
now use are either a SQLDataReader or a DataAdapter.

Both are similar, but a DataAdapter is a high-end data repository
designed to cache multiple tables in your application. It is actually
a mini database, a kind of front-end processor for SQL Server. While
your description seems to imply that you would benefit from using a
DataAdapter, this may not be entirely true, as a this object is quite
complicated and takes some experience to use efficiently.

A SQLDataReader is most similar to an ASP style disconnected
ADORecordset, so if your model app uses these, then porting to ASP
might be simpler, at least in the first pass, using these. They are
usually sufficient to read data and forward to any of the datalist
type webcontrols you have listed above.

Look at the ASP.NET examples supplied with the SDK and also available
online at: http://samples.gotdotnet.com/quickstart/aspplus/

Make special note of the examples titled: Server-side Data Access and
Data Binding to Server Controls.

good luck

-- ipgrunt
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top