-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.aspx.cs
50 lines (41 loc) · 1.31 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
45
46
47
48
49
50
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 signup : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
bool check_user()
{
string check = "select count(*) from [Table] where Email = '" + E.Text + "' ";
SqlCommand chh = new SqlCommand(check, con);
con.Open();
int temp = Convert.ToInt32(chh.ExecuteScalar().ToString());
con.Close();
if (temp == 1)
{
Label1.Text = "Already Registered";
return false;
}
return true;
}
protected void register_Click(object sender, EventArgs e)
{
if (check_user())
{
String ins = "Insert into [Table](Name,Email,Password) values('" + N.Text + "', '" + E.Text + "' , '" + P.Text + "')";
SqlCommand com = new SqlCommand(ins, con);
con.Open();
com.ExecuteNonQuery();
con.Close();
Response.Redirect("login.aspx");
}
}
}