-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeedbackForm.aspx.cs
59 lines (50 loc) · 1.47 KB
/
FeedbackForm.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class FeedbackForm : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True");
con.Open();
}
protected void Button7_Click(object sender, EventArgs e)
{
try
{
if ((TextBox1.Text != "") || (TextBox2.Text != "") || (TextBox3.Text != ""))
{
SqlCommand cmd = new SqlCommand("Insert into Feedback values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "')", con);
cmd.ExecuteNonQuery();
Empty();
Response.Redirect("FeedbackFlash.aspx");
}
else
{
Response.Write("<script>alert('Please fill all the fields...')</script>");
}
}
finally
{
con.Close();
}
}
private void Empty()
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
}
}