13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

344<strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>: A Beginner’s <strong>Guide</strong>DataList Control Donor's Name:&nbsp;Email:-----------------------------Cut HereOnce you’ve entered the <strong>ASP</strong>.<strong>NET</strong> portion of the code, open the C# window. You can usemost of the C# code for the previous two examples making minor but important changes.The following shows the <strong>com</strong>plete C# listing:C# DataList.aspx.csusing System;using System.Data.SqlClient;public partial class DataList : System.Web.UI.Page{private SqlConnection hookUp;private SqlCommand sqlCmd;private SqlDataReader readBind;protected void Page_Load(object sender, EventArgs e){hookUp = new SqlConnection("Server=localhost\\SqlExpress;Database=VoteNow;" +"Integrated Security=True");sqlCmd = new SqlCommand("SELECT FirstName, LastName, EmailFROM Supporters", hookUp);hookUp.Open();

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!