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.

Chapter 12: ADO.<strong>NET</strong>: Hello Database 311div{font-family:Arial,Helvetica,Sans-Serif;color:#cc0000;line-height:normal;}Dynamic Data EntryPlease fill out the form:&nbsp;Last Name&nbsp;First Name&nbsp;Email Address&nbsp;Amount of DonationNote the different web controls in the <strong>ASP</strong>.<strong>NET</strong> portion, and see how they are used to passvalues to the table in the database in the C# part of the application.C# DynamicEntry.aspx.csusing System;using System.Data.SqlClient;public partial class DynamicEntry : System.Web.UI.Page{private DateTime currentDate;private string strInsert;private SqlCommand sqlCmd;private SqlConnection hookUp;protected void EnterData(object sender, EventArgs e){currentDate = DateTime.Now;hookUp = new SqlConnection("Server=localhost\\SqlExpress;Database=VoteNow;" +"Integrated Security=True");strInsert = "INSERT INTO Supporters(LastName, FirstName,";

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

Saved successfully!

Ooh no, something went wrong!