Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function split() is deprecated in /home3/vvaswani/public_html/community/columns/trog/article.php on line 101

Deprecated: Function eregi_replace() is deprecated in /home3/vvaswani/sql.php on line 301

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home3/vvaswani/public_html/community/columns/trog/article.php on line 107

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home3/vvaswani/public_html/community/columns/trog/article.php on line 109

Deprecated: Function ereg_replace() is deprecated in /home3/vvaswani/public_html/community/columns/trog/article.php on line 124

Deprecated: Function ereg_replace() is deprecated in /home3/vvaswani/public_html/community/columns/trog/article.php on line 125

Deprecated: Function split() is deprecated in /home3/vvaswani/public_html/community/columns/trog/article.php on line 127

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174

Deprecated: Function ereg() is deprecated in /home3/vvaswani/db-mysql.php on line 174
The Melonfire Community - Trog
Logo         Community
  Trog
Services
The Company
Community
Columns
Your Account
Contact Us
 
 
ASP.NET Basics (part 8): Data Overload
Use the ADO.NET classes to build dynamic data-driven Web pages with ASP.NET and C#

| Dumped! |

Now that you're all excited about ADO.NET, lets get our hands dirty with some code, shall we?

First, some knowledge of SQL will come in handy over the next few pages. In case you don't know SQL, don't worry - it's extremely simple, and a few minutes with the "Speaking SQL" tutorial at http://www.melonfire.com/community/columns/trog/article.php?id=39 will have you executing queries like an expert.

Next, we need some data to play with. For the following examples, I shall be using a Microsoft SQL Server 2000 database called "pubs" and a table named "starwars" containing a list of characters that play vital roles in the epic Star Wars series. Here's the SQL code to create the table (you can use the Query Analyzer tool included with SQL Server 2000 to execute them):


CREATE TABLE starwars (
   id int IDENTITY (1, 1) NOT NULL ,
   name varchar (50) NULL ,
   homeworld varchar (50) NULL ,
   species varchar (50) NULL ,
   gender varchar (50) NULL ,
   affiliation varchar (50) NULL
)

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('Darth Maul','Iridonia','Zabrak','Male','Sith')

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('Obi-Wan Kenobi','NA','Human','Male','Jedi')

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('Qui-Gon Jinn','NA','Human','Male','Jedi')

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('C-3PO','Tatooine','Droid','NA','Rebel Alliance')

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('Luke Skywalker','Tatooine','Human','Male','Jedi')

INSERT INTO starwars(name, homeworld, species, gender, affiliation)
VALUES('Darth Vader','Tatooine','Human','Male','Empire')


Once the table has been created, execute the following query in the Query Analyzer to test whether the data has been inserted properly:


SELECT * FROM starwars


If you see a list of records, as below, you can be rest assured that the data was inserted properly.

Output image

With all that out of the way, let's write some code, shall we?


How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!


previous page more like this  print this article  next page
 
Search...
 
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
more...
 
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
more...
 
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
more...
 
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
more...
 
In cut!...
American Chai
The Core
Possession
more...
 
Find out how you can use this article on your own Web site!


Copyright © 1998-
Strict Standards: mktime(): You should be using the time() function instead in /home3/vvaswani/public_html/community/columns/trog/article.php on line 731
2018 Melonfire. All rights reserved
Terms and Conditions | Feedback