Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Database driven website?
Old 04-06-2006, 10:35 AM Database driven website?
Novice Talker

Posts: 8
Trades: 0
Hi everyone! I am new to the site but not new to forums... I work for a company that has asked me if i can create a website that would store information about all of our employees. Since we only have less than 50 employees I know there won't be a huge storage issue. However, I only have experience in creating static webpages typically using Frontpage which i really don't care for ever since i saw a friend working on Dreamweaver (I beginging to learn that). My question is...lets say I create a basic database in SQL how do i get my webpages to retrieve the information from the database and i don't mean syntax. For example must the webpage coding exist in the same directory as the database? Or do you tell the site each time your about to pull information from the database, where the database is located IP address, domain, etc? Can u store the webpages within the database itself? Obviously I am pretty lost on the concept of using a database driven site.If anybody would be so kind as to provide a very basic down a dirty explination of how something like this works i would GREATLY appreciate it!

in addition...my office computer has MS SQL Enterprise Manager, Profiler, Querey Analizyer, etc. Which one would i use to create the database? If none where do you get MYSQL? Again i apologize for the newbie questions but i learn fast!!! Thanks!
Vertigo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-06-2006, 12:54 PM Re: Database driven website?
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
You can create the database in MS SQL Enterprise Manager just as you would with any other database. Just create the tables and stored procedures (if you want to use SP's, that is)

A dynamic website connects to a database with something called a connection string. An example is:
Data Source=SERVERNAME;Initial Catalog=DatabaseName;Integrated Security=False;User ID=DBUsername;Password=DBPassword;
(there are others, depending on what database you use/how you connect/etc)
Depending on which language you use, the connection string is used differently. But it doesn't matter where the website is hosted, it can be on a completely different server to the database as long as it has the correct access rights.

If you're using SQL Server, my reccomendation would be to do your code in ASP.NET - it fits in very nicely with SQL Server and theres loads of tutorials and examples on the web. A good place to start is www.asp.net

- Mina
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 04-06-2006, 01:24 PM Re: Database driven website?
Novice Talker

Posts: 8
Trades: 0
Quote:
Originally Posted by Minaki
You can create the database in MS SQL Enterprise Manager just as you would with any other database. Just create the tables and stored procedures (if you want to use SP's, that is)

A dynamic website connects to a database with something called a connection string. An example is:
Data Source=SERVERNAME;Initial Catalog=DatabaseName;Integrated Security=False;User ID=DBUsername;Password=DBPassword;
(there are others, depending on what database you use/how you connect/etc)
Depending on which language you use, the connection string is used differently. But it doesn't matter where the website is hosted, it can be on a completely different server to the database as long as it has the correct access rights.

If you're using SQL Server, my reccomendation would be to do your code in ASP.NET - it fits in very nicely with SQL Server and theres loads of tutorials and examples on the web. A good place to start is www.asp.net

- Mina
So I can create the website in html, then create the database in sql or access etc, and then use asp.net to tell the webpage where to located the database and then i can used sql code withing the html on the webpage to display the database information. Am i getting this right? Thanks!
Vertigo is offline
Reply With Quote
View Public Profile
 
Old 04-06-2006, 06:42 PM Re: Database driven website?
Novice Talker

Posts: 8
Trades: 0
Anybody?? Basic stuff just trying to figure out how it all ties together..THANKS!
Vertigo is offline
Reply With Quote
View Public Profile
 
Old 04-07-2006, 07:24 AM Re: Database driven website?
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Almost right...

ASP.NET is code that generates HTML based on something, usually the results of an SQL Query. in ASP.NET, your connection string would go in a global config file so it could be used from any page.

Imagine an ASP.NET page as like a template - most of it is in HTML, however you put ASP.NET controls within the HTML. For example:

Code:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Rocket 3G League Table</title>
<metahttp-equiv="refresh"content="30"/>
<styletype="text/css">
@import url( Default.css );
</style>
</head>
<body>
<formid="frmMain"runat="server">
<div>
<divid="Title">
<h1>Rocket 3G Leaguetable</h1>
</div>
<divstyle="padding: 10px;">
<asp:DataGridID="dgData"runat="server"AutoGenerateColumns="false"Width="100%"ShowFooter="true"OnItemDataBound="dgData_ItemDataBound"Font-Size="Large"BorderWidth="0"CellSpacing="1">
<HeaderStyleHorizontalAlign="Center"Font-Bold="true"BackColor="#FF6600"/>
<ItemStyleHorizontalAlign="Center"BackColor="#FFFF99"/>
<FooterStyleHorizontalAlign="Center"Font-Size="Large"BackColor="#999999"Font-Bold="true"/>
<Columns>
<asp:BoundColumnHeaderText="Agent Name"DataField="Name"ItemStyle-HorizontalAlign="Left"HeaderStyle-HorizontalAlign="Left"FooterText="Total"FooterStyle-HorizontalAlign="Left"/>
<asp:BoundColumnHeaderText="Calls<br />Today"DataField="Calls"ItemStyle-Width="110px"/>
<asp:BoundColumnHeaderText="Daily<br />Sales"DataField="DailySales"ItemStyle-Width="110px"/>
<asp:BoundColumnHeaderText="Monthly<br />Sales"DataField="Sales"ItemStyle-Width="110px"/>
<asp:BoundColumnHeaderText="Monthly<br />Connections"DataField="Connections"ItemStyle-Width="110px"/>
<asp:BoundColumnHeaderText="Points"DataField="Points"ItemStyle-Width="110px"/>
</Columns>
</asp:DataGrid>
</div>
<divstyle="text-align: center;">
<asp:ImageID="imgScoreboard"runat="server"AlternateText="Scoreboard"/>
</div>
</div>
</form>
</body>
</html>
That's the page I'm working on at the moment. It's mostly plain HTML, but the tags prefixed with asp: are 'Server Controls' - the asp:DataGrid will be rendered as an HTML Table of Data, and the asp:Image will be rendered as an html <img ... /> tag.

Now all I need to do is get the data from the SQL Database and merge it with that asp:DataGrid (that's known as 'Data Binding'. ASP.NET will take the data and format it into an HTML Table based on all the settings in the <asp:DataGrid> control.

Code:
SqlConnection MyConnection = newSqlConnection(ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString);
SqlCommand MyCommand = newSqlCommand("SELECT * FROM LeagueData", MyConnection);
MyConnection.Open();
try
{
SqlDataReader MyReader = MyCommand.ExecuteReader();
dgData.DataSource = MyReader;
dgData.DataBind();
}
finally
{
MyConnection.Close();
}


There's loads of other controls you can use for different things, and practicly any aspect of the HTML page can be controlled from the code. The code above is in C#, but you can also do it in VisualBasic.NET, J#, or any other .NET language.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Minaki; 04-07-2006 at 07:27 AM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 04-07-2006, 10:53 AM Re: Database driven website?
Novice Talker

Posts: 8
Trades: 0
Minaki Thank you!! I am starting to understand!

I am working with a local design company and they mention they are working on a website right now designed in ASP and i said that i've heard of ASP.NET and he told me that they are two different creatures. Can i do what u mentioned above in ASP vs ASP.NET?
Vertigo is offline
Reply With Quote
View Public Profile
 
Old 04-07-2006, 04:26 PM Re: Database driven website?
mxrider's Avatar
Experienced Talker

Posts: 42
Trades: 0
its all in .ap right? so your using windows standards to say the least?... hmmm.. i dont have a solution i thought i did but good luck i really hope someone helps ya
mxrider is offline
Reply With Quote
View Public Profile
 
Old 04-07-2006, 05:03 PM Re: Database driven website?
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Yes, you can, the structure is slightly different though - ASP code tends to all get crammed into the same file along with the HTML, connection string & all.

Think of ASP.NET as the next version of ASP. ASP is old. There's little point in learning it any more unless you need to support existing ASP websites. .NET is the way forward - it solves a lot of the problems that ASP brought in - it's a lot more structured, plus a lot of common tasks are built right into the framework - such as sending e-mail, uploading files, and working with the file system on the server. In .NET, these things can be done with just a few lines of code whereas in ASP you had to work with third party COM objects.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 04-26-2006, 12:07 PM Re: Database driven website?
Novice Talker

Posts: 8
Trades: 0
Minaki thanks for the help and advice! Its much appreciated!!
Vertigo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Database driven website?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.61744 seconds with 12 queries