473,387 Members | 1,542 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,387 software developers and data experts.

Data-Storage Suggestions

Hi,

I'd like to build a .NET Website that has any number of documents that
visitors can read. In addition to the documents, I may have one or two
downloads associated with each document. I'm trying to figure out the best
way of storing these files and documents (database vs. Web pages).

I asked this once before and got some comments about using both. And, in
fact, I've just been able to confirm that this is what sites like Code
Project do.

But, although I'm an experienced programmer, I'm relatively new to .NET and
Website database programming. So I must admit that I didn't understand most
of the suggestions I was given.

Does anyone know of an example or a site that documents, in some detail, how
one would approach this type of site?

Thanks for any suggestions.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm
Mar 13 '06 #1
2 1339

For performance reasons, its usually best to keep a relative reference to a
file in the database, but keep the file on disk somewhere.

Lets take images of users for example.

You ~could store the image of each employee in the database.
Or...
you could store the relative url of each image in the database, and keep the
files statically in a folder on the web server.

For performance reasons, the 2nd one is more desirable. Because you hit the
db less (a filename is alot smaller than a big BLOB of data).
If the images don't change very often, then this is a good approach.

...

For hmtl pages, I'd consider saving the html in the database, but also
"publishing" them.
What I mean is that... if you have pages where users "create their own"
html.... then I'd keep that in the database.
I'd consider always getting the html from the database .... but then you're
incurring a db hit, just to render some html.
This is where I like the "hybrid" solution. You persist the html in the
database, but write it out to the webserver.
You get the perfformance of not hitting the database, because the pages are
written out as html. But you can allow users to edit, and then "publish"
updates.

If its pdf's, then the "keep the relative url" in the db is a good solution,
and just have copies of the pdf on the webserver.

You have to decide and architect based on certain decisons. that's why
there isn't one "right answer".
It depends how often the data inside the documents change, and if you need
to minimize the db hits....because you're web page needs to be scaleable.

But based on what you have in your description, I might do something like
this:

Document (table in the db)
DocUUID, DocName, DocRelativeURL
Download (table in db)
DownloadUUID, DocUUID, DownloadName, DownloadURL
You can create a strongly typed dataset. Fill it with the data from these 2
tables.
On your aspx page.. you'll bind a Repeater, or GridView (or 1.1 a datagrid)
to the Document(s) in the strongly typed dataset.
For each Document d in the Document table (each row basically), you'll
create a child Repeater or DataList to show the Downloads for each Document.

Here is an article. it is NOT exactly what you're looking for, but
http://www.code101.com/Code101/Displ...le.aspx?cid=68

http://www.code101.com/code101/Demos/demo68.aspx

will show how to loop on items, and then how to nest the children items.

You do not need the checkbox stuff. the more important things are the
DataList

the author there is NOT using a strongly typed dataset, fyi.

Unless you have a huge need... to write the actual content to the database,
I'd err on the side of relative URLS.

Ex data:

Document (table in the db)
DocUUID, DocName, DocRelativeURL
123,"Employee Phone List","/Files/employee.doc"
234,"Health Care Details","/Files/health_care.doc"
Download (table in db)
DownloadUUID, DocUUID, DownloadName, DownloadURL
1001,123,"How to Use Word",http://www.microsoft.com/howtouseword.rtf
1002,123,"Employee HandBook","/Files/emphandbook.pdf"
2001,234,"Met Life Rules",www.metlife.com/files/rules.txt
2002,234,"Met Life KB",http://www.metlife.com/kb.txt
how it comes out in aspx potentially
(HERE is a href )

Employee Phone List | Click HERE
--> Download "How to Use Word" HERE
-->Download "Employee Handbook" HERE
Health Care Details | Click HERE
--> Download "Met Life Rules" HERE
-->Download "Met Life KB" HERE
Take the example I give, and the demo from the other guy, and visualize what
the end might look at.


"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...
Hi,

I'd like to build a .NET Website that has any number of documents that
visitors can read. In addition to the documents, I may have one or two
downloads associated with each document. I'm trying to figure out the best
way of storing these files and documents (database vs. Web pages).

I asked this once before and got some comments about using both. And, in
fact, I've just been able to confirm that this is what sites like Code
Project do.

But, although I'm an experienced programmer, I'm relatively new to .NET and Website database programming. So I must admit that I didn't understand most of the suggestions I was given.

Does anyone know of an example or a site that documents, in some detail, how one would approach this type of site?

Thanks for any suggestions.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

Mar 13 '06 #2
Thanks Sloan,

Like I said, I'm pretty new to this stuff. I'll print out your response and
go over it in detail.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

"sloan" <sl***@ipass.net> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...

For performance reasons, its usually best to keep a relative reference to
a
file in the database, but keep the file on disk somewhere.

Lets take images of users for example.

You ~could store the image of each employee in the database.
Or...
you could store the relative url of each image in the database, and keep
the
files statically in a folder on the web server.

For performance reasons, the 2nd one is more desirable. Because you hit
the
db less (a filename is alot smaller than a big BLOB of data).
If the images don't change very often, then this is a good approach.

..

For hmtl pages, I'd consider saving the html in the database, but also
"publishing" them.
What I mean is that... if you have pages where users "create their own"
html.... then I'd keep that in the database.
I'd consider always getting the html from the database .... but then
you're
incurring a db hit, just to render some html.
This is where I like the "hybrid" solution. You persist the html in the
database, but write it out to the webserver.
You get the perfformance of not hitting the database, because the pages
are
written out as html. But you can allow users to edit, and then "publish"
updates.

If its pdf's, then the "keep the relative url" in the db is a good
solution,
and just have copies of the pdf on the webserver.

You have to decide and architect based on certain decisons. that's why
there isn't one "right answer".
It depends how often the data inside the documents change, and if you need
to minimize the db hits....because you're web page needs to be scaleable.

But based on what you have in your description, I might do something like
this:

Document (table in the db)
DocUUID, DocName, DocRelativeURL
Download (table in db)
DownloadUUID, DocUUID, DownloadName, DownloadURL
You can create a strongly typed dataset. Fill it with the data from these
2
tables.
On your aspx page.. you'll bind a Repeater, or GridView (or 1.1 a
datagrid)
to the Document(s) in the strongly typed dataset.
For each Document d in the Document table (each row basically), you'll
create a child Repeater or DataList to show the Downloads for each
Document.

Here is an article. it is NOT exactly what you're looking for, but
http://www.code101.com/Code101/Displ...le.aspx?cid=68

http://www.code101.com/code101/Demos/demo68.aspx

will show how to loop on items, and then how to nest the children items.

You do not need the checkbox stuff. the more important things are the
DataList

the author there is NOT using a strongly typed dataset, fyi.

Unless you have a huge need... to write the actual content to the
database,
I'd err on the side of relative URLS.

Ex data:

Document (table in the db)
DocUUID, DocName, DocRelativeURL
123,"Employee Phone List","/Files/employee.doc"
234,"Health Care Details","/Files/health_care.doc"
Download (table in db)
DownloadUUID, DocUUID, DownloadName, DownloadURL
1001,123,"How to Use Word",http://www.microsoft.com/howtouseword.rtf
1002,123,"Employee HandBook","/Files/emphandbook.pdf"
2001,234,"Met Life Rules",www.metlife.com/files/rules.txt
2002,234,"Met Life KB",http://www.metlife.com/kb.txt
how it comes out in aspx potentially
(HERE is a href )

Employee Phone List | Click HERE
--> Download "How to Use Word" HERE
-->Download "Employee Handbook" HERE
Health Care Details | Click HERE
--> Download "Met Life Rules" HERE
-->Download "Met Life KB" HERE
Take the example I give, and the demo from the other guy, and visualize
what
the end might look at.


"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:ub**************@TK2MSFTNGP10.phx.gbl...
Hi,

I'd like to build a .NET Website that has any number of documents that
visitors can read. In addition to the documents, I may have one or two
downloads associated with each document. I'm trying to figure out the
best
way of storing these files and documents (database vs. Web pages).

I asked this once before and got some comments about using both. And, in
fact, I've just been able to confirm that this is what sites like Code
Project do.

But, although I'm an experienced programmer, I'm relatively new to .NET

and
Website database programming. So I must admit that I didn't understand

most
of the suggestions I was given.

Does anyone know of an example or a site that documents, in some detail,

how
one would approach this type of site?

Thanks for any suggestions.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm


Mar 14 '06 #3

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

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
9
by: Tony Lee | last post by:
Some time a ago, on this newsgroup the following comments were made in recommending good references for Access (2003) >I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
1
by: djozy | last post by:
Please, I want to insert data into SQL Server database. I know for this commmand: SqlCommand myCommand= new SqlCommand("INSERT INTO table (Column1, Column2) " + "Values ('string', 1)",...
1
by: T8 | last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.