Difference between revisions of "DD Class9"

esse quam videri
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:Data Design]]
 
[[Category:Data Design]]
 
==Review First Normal Form==
 
 
Let build the example for the homework.
 
 
==Build Interface to GameDB==
 
 
'''Games'''
 
{| class="wikitable" cellpadding="5" cellspacing="0"
 
!GameTitle !!  GameGenre !! DeveloperName !! Platform(s) !! Year !! DeveloperWebsite !! GameWebsite
 
|-
 
| Quake1 || FPS || id || Dos || 1996 || http://www.idsoftware.com/ || http://www.idsoftware.com/games/quake/quake/
 
|-
 
| Diablo|| RPG|| Blizzard || Windows 95|| 1996 || http://www.blizzard.com/  || http://www.blizzard.com/diablo/
 
|-
 
| SimCity || Sim || Interplay || Dos || 1993 || http://www.interplay.com/  || http://www.maxis.com/
 
|}
 
 
Tables Games, Developers, Websites, Platforms?
 
 
Build Views
 
 
  
 
==DataReader==
 
==DataReader==
Line 84: Line 62:
  
 
</csharp>
 
</csharp>
 +
 +
 +
==Review First Normal Form==
 +
 +
Let build the example for the homework.
 +
 +
==Build Interface to GameDB==
 +
 +
'''Games'''
 +
{| class="wikitable" cellpadding="5" cellspacing="0"
 +
!GameTitle !!  GameGenre !! DeveloperName !! Platform(s) !! Year !! DeveloperWebsite !! GameWebsite
 +
|-
 +
| Quake1 || FPS || id || Dos || 1996 || http://www.idsoftware.com/ || http://www.idsoftware.com/games/quake/quake/
 +
|-
 +
| Diablo|| RPG|| Blizzard || Windows 95|| 1996 || http://www.blizzard.com/  || http://www.blizzard.com/diablo/
 +
|-
 +
| SimCity || Sim || Interplay || Dos || 1993 || http://www.interplay.com/  || http://www.maxis.com/
 +
|}
 +
 +
Tables Games, Developers, Websites, Platforms?
 +
 +
Build Views

Revision as of 02:27, 9 November 2009


DataReader


1 Connection Object <csharp> //Connection string comes from web config SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["cheeseConnectionString"].ConnectionString); </csharp>

web.config connection strings

<xml> <configuration>

              <connectionStrings>

<add name="cheeseConnectionString" connectionString="Data Source=iamdb;Initial Catalog=cheese;User ID=student;Password=Student" providerName="System.Data.SqlClient"/> </connectionStrings> </xml>

2 Command Object <csharp>string strSQL = "SELECT CheeseName,CheeseDescription FROM cheese";

   string strResultsHolder = "";
   
   SqlCommand objCommand = new SqlCommand(strSQL, objConnection);

</csharp>

3 Reader and Reading <csharp> SqlDataReader objDataReader = null; //Reader to read through the result

   try
   {
       objConnection.Open();                                       //Open Connection
       objDataReader = objCommand.ExecuteReader();
       while (objDataReader.Read() == true)
       {
           strResultsHolder += String.Format("{0}:{1}

", objDataReader["CheeseName"], objDataReader["CheeseDescription"]); } } catch (Exception e) { lblErr.Text = "Connection failed to open successfully.
"; lblErr.Text += e.ToString(); } finally { objDataReader.Close(); //Close Reader objConnection.Close(); //Close Connection
   }
   //Write results
   divListCheese.InnerHtml = strResultsHolder;

}

</csharp>


Review First Normal Form

Let build the example for the homework.

Build Interface to GameDB

Games

GameTitle GameGenre DeveloperName Platform(s) Year DeveloperWebsite GameWebsite
Quake1 FPS id Dos 1996 http://www.idsoftware.com/ http://www.idsoftware.com/games/quake/quake/
Diablo RPG Blizzard Windows 95 1996 http://www.blizzard.com/ http://www.blizzard.com/diablo/
SimCity Sim Interplay Dos 1993 http://www.interplay.com/ http://www.maxis.com/

Tables Games, Developers, Websites, Platforms?

Build Views