-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistrationForm.aspx.cs
51 lines (40 loc) · 1.55 KB
/
RegistrationForm.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
namespace TourAndTravel2
{
public partial class RegistrationForm : System.Web.UI.Page
{
string gender;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void buttonRegister_Click(object sender, EventArgs e)
{
MySqlConnection connection = new MySqlConnection("server=localhost;user id=root;database=awp;password=root");
MySqlCommand cmd = connection.CreateCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "INSERT INTO userreg(name, address, gender, phone, email, username, password) values('"+ textName.Text + "', '"+ textAddress.Text + "', '"+ gender + "', '"+ textPhone.Text + "', '"+ textEmail.Text + "', '"+ textUserName.Text + "', '"+ textPassword.Text + "')";
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
Response.Write("<script> alert ('User is registered successfully!')</script>");
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
gender = "male";
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
gender = "female";
}
protected void RadioButton3_CheckedChanged(object sender, EventArgs e)
{
gender = "others";
}
}
}