-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseAllotment.aspx.cs
More file actions
87 lines (69 loc) · 2.69 KB
/
CourseAllotment.aspx.cs
File metadata and controls
87 lines (69 loc) · 2.69 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
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
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class CourseAllotment : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=studentform;Integrated Security=True;Encrypt=False");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("course_allot_insert", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sname", SqlDbType.VarChar).Value = TextBox2.Text;
cmd.Parameters.AddWithValue("@scourse", SqlDbType.VarChar).Value = TextBox8.Text;
cmd.Parameters.AddWithValue("@cfee", SqlDbType.Int).Value = TextBox4.Text;
cmd.Parameters.AddWithValue("@feetype", SqlDbType.VarChar).Value = DropDownList1.SelectedValue;
cmd.Parameters.AddWithValue("@fname", SqlDbType.VarChar).Value = TextBox7.Text;
cmd.Parameters.AddWithValue("@fhandlesub", SqlDbType.VarChar).Value = TextBox8.Text;
cmd.Parameters.AddWithValue("@sdoj", SqlDbType.DateTime).Value = TextBox1.Text;
cmd.Parameters.AddWithValue("@fid", SqlDbType.Int).Value = DropDownList3.SelectedItem.Text;
cmd.ExecuteNonQuery();
con.Close();
Response.Redirect("CourseAllotment.aspx");
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox7.Text = DropDownList3.SelectedValue;
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("CourseAllotment.aspx");
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from studentenquiry where sname='" + TextBox2.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
TextBox8.Text = dr["courses"].ToString();
}
else
{
Response.Write("No data found");
}
con.Close();
}
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from course where coursename='" + TextBox8.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
TextBox4.Text = dr["price"].ToString();
}
con.Close();
}
}