-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRazer.aspx.cs
44 lines (43 loc) · 1.43 KB
/
Razer.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Razer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
string strQuery = "insert into [Order] (game,email,location,creditcard,cost) values(@game,@email,@location,@creditcard,@cost)";
SqlCommand cmd = new SqlCommand(strQuery);
cmd.Parameters.AddWithValue("@game", "Razer");
cmd.Parameters.AddWithValue("@email", txt_email.Text);
cmd.Parameters.AddWithValue("@location", txt_location.Text);
cmd.Parameters.AddWithValue("@creditcard", txt_credit.Text);
cmd.Parameters.AddWithValue("@cost", "2500");
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
con.Close();
con.Dispose();
Response.Redirect("~/Razer.aspx");
}
}
}