using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.OleDb; using System.Net; public partial class AddOders : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { // Save to Database //String location = "E:\\AspNet_Jan2011\\MidTerm\\Florist.mdb"; String location = "Florist.mdb"; OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath(location)); conn.Open(); OleDbCommand command = conn.CreateCommand(); string strSQL; strSQL = "Insert into Orders (CustomerName, CustomerAddress, CustomerCity, CustomerState, CustomerZip, " + "CustomerPhone, ArrangmentID, DeliveryName, DeliveryAddress, DeliveryCity, DeliveryState, " + "DeliveryZip, DeliveryPhone) " + "values ('" + txtCustName.Text + "', '" + txtCustAddress.Text + "', '" + txtCustCity.Text + "', '" + txtCustState.Text + "'" + ", '" + txtCustZip.Text + "', '" + txtCustPhone.Text + "', '" + lstArrangement.Text + "', '" + txtDelName.Text + "'" + ", '" + txtDelAddress.Text + "', '" + txtDelCity.Text + "', '" + txtDelState.Text + "', '" + txtDelZip.Text + "'" + ", '" + txtDelPhone.Text + "')"; command.CommandType = CommandType.Text; command.CommandText = strSQL; command.ExecuteNonQuery(); conn.Close(); //MessageBox.Show("Your order has been submitted"); Response.Write(""); txtDelName.Text = ""; txtDelAddress.Text = ""; txtDelCity.Text = ""; txtDelState.Text = ""; txtDelZip.Text = ""; txtDelPhone.Text = ""; txtCustAddress.Text = ""; txtCustCity.Text = ""; txtCustName.Text = ""; txtCustPhone.Text = ""; txtCustState.Text = ""; txtCustZip.Text = ""; } protected void btnDeliverTo_Click(object sender, EventArgs e) { txtDelName.Text = txtCustName.Text; txtDelAddress.Text = txtCustAddress.Text; txtDelCity.Text = txtCustCity.Text; txtDelState.Text = txtCustState.Text; txtDelZip.Text = txtCustZip.Text; txtDelPhone.Text = txtCustPhone.Text; } }