design advice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey all,

I'm trying to create a personal media tracker in asp.net and had a few
design questions. Following is a snippet of my pertinent fields in my database

Media Table:
name
media type

Borrowed Table:
name
date borrowed
borrowed by


I'd like to display a datagrid of all my media, and then have a read-only
checkbox column that's checked when the media is checked out. I'm assuming
that in my media table I wouldn't already have a boolean field to indicate
whether it's checked out or not, correct? This would be calculated by the
records in the borrowed table.

So if I display all the records in my media table, what do i have to do to
make my requirement a reality?

thanks,
rodchar
 
Media Table:
name
media type

Borrowed Table:
name
date borrowed
borrowed by


I'd like to display a datagrid of all my media, and then have a
read-only checkbox column that's checked when the media is checked
out. I'm assuming that in my media table I wouldn't already have a
boolean field to indicate whether it's checked out or not, correct?
This would be calculated by the records in the borrowed table.

You don't have a key between your media table and your borrowed table...
you need a Foreign Key between the two tables so you can do a join.
 
10.4.
now what's my next step?

Lucas Tam said:
You don't have a key between your media table and your borrowed table...
you need a Foreign Key between the two tables so you can do a join.
 
Assuming "name" is your key field, here's the SQL call:

SELECT * FROM Media m LEFT JOIN Borrowed b ON m.name = b.name

Then in the datagrid, you'll want to specify an ItemDataBound event function
that checks or unchecks the checkbox depending upon the the precense of a
date in your date borrowed field.


Here's a link to a links page for many useful articles on DataGrids.

http://www.datagridgirl.com/articles.aspx

Enjoy!
 
Thanks i'll give a shot and let you know.

ESPN Lover said:
Assuming "name" is your key field, here's the SQL call:

SELECT * FROM Media m LEFT JOIN Borrowed b ON m.name = b.name

Then in the datagrid, you'll want to specify an ItemDataBound event function
that checks or unchecks the checkbox depending upon the the precense of a
date in your date borrowed field.


Here's a link to a links page for many useful articles on DataGrids.

http://www.datagridgirl.com/articles.aspx

Enjoy!
 
Back
Top