-
Notifications
You must be signed in to change notification settings - Fork 0
/
Regestration.aspx.cs
91 lines (87 loc) · 2.62 KB
/
Regestration.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class Regestration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string z = "";
int c = 0;
if (cname.Text == "")
{
z = z + "Enter College Name ";
c++;
}
if (caddress.Text == "")
{
z = z + "Enter College Address ";
c++;
}
if (tname.Text == "")
{
z = z + "Enter Team Name ";
c++;
}
if (tsize.Text == "")
{
z = z + "Enter Team Size ";
c++;
}
if (cpname.Text == "")
{
z = z + "Enter Captain Name ";
c++;
}
if (cpid.Text == "")
{
z = z + "Enter Email Id ";
c++;
}
if (cpno.Text == "")
{
z = z + "Enter Phone No ";
c++;
}
else if (altno.Text == "")
{
z = z + "Enter Alternative Phone No ";
c++;
}
if (c != 0)
{
Response.Write("<script>alert('" + z + "')</script>");
}
else
{
DateTime current = DateTime.Now;
string s = current.ToString();
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\Programig\Asp.net\Project\egvc_final\App_Data\Event.mdf;Integrated Security=True");
SqlDataAdapter adpt = new SqlDataAdapter();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "insert into reg values('" + cname.Text + "','" + caddress.Text + "','" + tname.Text + "','" + tsize.Text + "','" + cpname.Text + "','" + cpid.Text + "','" + cpno.Text + "','" + altno.Text + "','" + adname.Text + "','" + adeid.Text + "','" + adno.Text + "','" + s + "')";
cmd.Connection = con;
adpt.SelectCommand = cmd;
adpt.Fill(ds, "reg");
Response.Write("<script> alert('Data added successfully') </script>");
cname.Text = "";
caddress.Text = "";
tname.Text = "";
tsize.Text = "";
cpname.Text = "";
cpid.Text = "";
cpno.Text = "";
adname.Text = "";
adeid.Text = "";
adno.Text = "";
altno.Text = "";
}
}
}