-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathSignUp.aspx.cs
More file actions
47 lines (44 loc) · 1.51 KB
/
SignUp.aspx.cs
File metadata and controls
47 lines (44 loc) · 1.51 KB
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
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;
using System.Drawing;
public partial class SignUp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btSignup_Click(object sender, EventArgs e)
{
if (tbUname.Text != "" & tbPass.Text != "" && tbName.Text != "" && tbEmail.Text != "" && tbCPass.Text != "")
{
if (tbPass.Text == tbCPass.Text)
{
String CS = ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString1"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("insert into Users values('" + tbUname.Text + "','" + tbPass.Text + "','" + tbEmail.Text + "','" + tbName.Text + "','U')", con);
con.Open();
cmd.ExecuteNonQuery();
lblMsg.Text = "Registration Successfull";
lblMsg.ForeColor = Color.Green;
Response.Redirect("~/Signin.aspx");
}
}
else
{
lblMsg.ForeColor = Color.Red;
lblMsg.Text = "Passwords do not match";
}
}
else
{
lblMsg.ForeColor = Color.Red;
lblMsg.Text = "All Fields Are Mandatory";
}
}
}