Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp website??

Status
Not open for further replies.

leeolive

Programmer
May 14, 2002
46
GB
Hi

I am quite new to asp but am able to submit and retrieve to/from an access database via a webpage.

I have seen a site where all the pages are asp. How does this work? Is all the content stored in a database and which database would be able to store that much information/text?

See this website - all asp.


Appreciate the help!
Lee
 
ummm...yeah databases and stuff. There is no quick answer here. Just because a page has an asp extention doesnt mean that it gets its info from a database. Though it is possible to have entire sites that are generated from large SQL databases. So yes if ya want to make a big site using a database then i would suggest SQLServer or something. But Access could do fine for a small site.

Dunno if this helps any.

Cheers,
jstar7

-------------------------------------
...what rhymes with month?
 
No not all the content is necessarally stored in the database. The layout of the site will not change often enough for it to need to be stored in the db. Basically any content that won't be changing does not need to be stord in the database. You could do this, but the only possible reason I could think of storing all your static HTML in the database would be if you were going to provide some sort of form for the adinistrative user to modify this behind the scenes. Even then I think that I would store it in text files and include or write them as neeeded.

When it comes to the database you should only be storing data, not content. This means things that users enter into forms or data that will be used to generate dropdown boxes but not the actual forms or the select tags. The reasoning here is if you store the content in the database than you have lost a lot of the power having a database gives you. For example, we have a dropdown with colors. Occasionally as we think of a new color we want to add it to the website but don't want to have to go in and change the HTML by hand each and every time. Here is the display for that dropdown:
Code:
<%
Dim conn, rs, sql
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;MyDSN&quot;

sql = &quot;SELECT color_id, color_name FROM Colors&quot;
Set rs = conn.Execute(sql)

If rs.EOF Then
   Response.Write &quot;Error, no colors in the database&quot;
   Response.End
End If

rs.MoveFirst
Response.Write &quot;<select name=&quot;&quot;selColors&quot;&quot;>&quot;
Do Until rs.EOF
   Response.Write &quot;<option value=&quot;&quot;&quot; & rs(&quot;color_id&quot;) & &quot;&quot;&quot;>&quot; & rs(&quot;color_name&quot;) & &quot;</option>&quot;
   rs.MoveNext
Loop
Response.Write &quot;</select>&quot;
conn.Close
Set rs = Nothing
Set conn = Nothing

Now thats what the code would look like if we stored only the data in the database (in this case the colors). If also wanted to make a page where you could add new colors it would be relatively simple, basically a text entry box in a form that was submitted to another page that inserted that new color to the colors table.

On the other hand if we stored the whole select statement in the database:
Code:
<%
Dim conn, rs, sql
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;MyDSN&quot;

sql = &quot;SELECT html FROM Content WHERE name='selColor'&quot;
Set rs = conn.Execute(sql)

If rs.EOF Then
   Response.Write &quot;Error, no colors in the database&quot;
   Response.End
Else
   Response.Write rs(&quot;html&quot;)
End If

conn.Close
Set rs = Nothing
Set conn = Nothing

Now we have shortened our code and moved the content to the data base, but how will we change that data? If suddenly decide we want to also output the colors as a simple list in the html page then we would have to create a new database entry by hand and hope we didn't forget any of them, then when a new color was added we would have to add it to botht the selColor entry and the list entry.

That is the problem with mixing content and data. Once you mix them you no longer have any data and lose the power of the database, which is to allow you to store the data in a searchable format for any use, rather than store the content for a single use. Beyond that we also would then have to select that content from the database for every little thing we wanted to display. This would be extremely slow as we are not only requesting more data, but probably making more requests as well.

hope this helped,
-Tarwn

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
minilogo.gif alt=tiernok.com
The never-completed website
 
Tarwn is of course exactly right -- you don't want to be storing anything in the database that you don't need to.

I will note, however, that content management systems (also known as publishing systems) do store the bulk of the page in a database. A site like CNN or News.com or what have you is entirely usually generated on the fly, with all of the content being drawn from the database as users request it. That means that there are templates that contain the framework for the page but that the html that's embedded in the stories is in the data stored in the database, an entirely dynamic system.

(Some content managagement systems &quot;publish&quot; static html pages rather than drawing the content in dynamically for each page, but this is less common than you might think.)

Note that in entirely dynamic systems with a lot of traffic the site will almost always include a large amount of caching to keep database traffic down, and often involves some very complex caching where chunks of pages can be cached as well as full pages (allowing for rotating ads, etc.).
 
Good point, perhaps I should have made a better distinction betwen data, content, and presentation. Sorry about any confusion I may have caused,
-Tarwn

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
minilogo.gif alt=tiernok.com
The never-completed website
 
HI, Access handles both the screens and (Jet) database function as well as reports. You can create an application using MS Access to enter and maintain the data and then make that data available to an ASP web application. The web page can connect to the Access database using ADO or ODBC connectivity. You can also write web reports using ASP.Net Crystal reports by using Visual Studio.Net.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top