-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.aspx.cs
44 lines (40 loc) · 1.32 KB
/
signup.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.SqlClient;
using System.Configuration;
namespace WebApplication17
{
public partial class login : System.Web.UI.Page
{
SqlConnection conn;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
cmd = new SqlCommand("Insert Into login(un,p,c,w) Values(@un,@p,@c,@w)", conn);
cmd.Parameters.AddWithValue("@un", TextBox1.Text);
cmd.Parameters.AddWithValue("@p", TextBox2.Text);
cmd.Parameters.AddWithValue("@c", TextBox3.Text);
cmd.Parameters.AddWithValue("@w", TextBox4.Text);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
//Label1.Text = "Data Saved";
Response.Redirect("login.aspx");
}catch(Exception ex)
{
Label1.Text = ex.Message;
}
}
}
}