473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataList, Repeater, or Data Grid?


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,tblh orseentry.bestbet,tblhorseentry.topplay,tblhorseen try.rating,tblhorseentry.speedpr,tblrace.raceid,tb lrace.racedate,tblrace.raceno,tblrace.racelength,t blrace.raceturf,tblrace.racedescription,tblrace.ho rseage,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

Nov 19 '05 #1
1 1658
On 23 Feb 2005, ".Net Sports" <ba********@cox.net> postulated in
news:11**********************@f14g2000cwb.googlegr oups.com:
Subject: DataList, Repeater, or Data Grid?
From: ".Net Sports" <ba********@cox.net>
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,tblh orseentry.bestbet ,tblhorseentry.topplay,tblhorseentry.rating,tblhor seentry.speedpr,tbl
race.raceid,tblrace.racedate,tblrace.raceno,tblrac e.racelength,tblrac
e.raceturf,tblrace.racedescription,tblrace.horseag e,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
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
6
by: Thanh | last post by:
I created an ASP.NET project and dropped a DataList on the web form. I then wrote a simple class to return data: namespace Playing { public class PositionData { private string name; private...
0
by: Shun Duke | last post by:
I have working code allowing me to nest repeaters inside datalists using relations and child rows but this does not allow me to acheive my goal. What I want to be able to do is display small...
5
by: Ben Fidge | last post by:
I'm using DataList to present tabular data but am often having problems with some rows column alignment being out of synch with the rest of the rows. My DataList looks similar to this...: ...
5
by: serge calderara | last post by:
Dear all, Does this datalist control is somehow similar as a datasource for any other control ? I really to catch the use of it, can we assimilate that control as a kind of dataset or...
2
by: serge calderara | last post by:
Dear all, I have make some basic testing on Repeater and DataList object. I have notice for sure that if your database retrive data contains 3 records, then both controls will repeat the...
1
by: Simon Cheng | last post by:
When I tried to display data in datalist and repeater, the first data item always disappears in all datalist and repeaters in my web forms. The code I use for the html page is: <TD...
1
by: David Lozzi | last post by:
Howdy, I have a datalist which is displaying a list of categories and their associated sub categories in secondary datalists. Works great in a single column. Unfortunaly when i switch it to...
2
by: Paulo | last post by:
What is DetailsView, FormView, DataList, Repeater components? Any differences? VS 2005 asp.net C#
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.