student adm

Download Student Adm

If you can't read please download the document

Upload: kamal-tiwari

Post on 14-Feb-2016

215 views

Category:

Documents


0 download

DESCRIPTION

ADMISSION

TRANSCRIPT

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;using System.Configuration;public partial class StudentAdmison : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void btnSave_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString); con.Open(); string qry = "insert into student values(@t1,@t2,@t3,@t4,@t5,@t6,@t7,@t8,@t9)"; SqlCommand cmd = new SqlCommand(qry, con); cmd.Parameters.AddWithValue("@t1", TextBox1.Text); cmd.Parameters.AddWithValue("@t2", TextBox2.Text); cmd.Parameters.AddWithValue("@t3", TextBox3.Text); string sx = ""; if (RadioButton1.Checked) sx = "male"; else sx = "female"; cmd.Parameters.AddWithValue("@t4", sx); cmd.Parameters.AddWithValue("@t5", TextBox4.Text); cmd.Parameters.AddWithValue("@t6", TextBox5.Text); cmd.Parameters.AddWithValue("@t7", TextBox6.Text); cmd.Parameters.AddWithValue("@t8", TextBox7.Text); cmd.Parameters.AddWithValue("@t9", TextBox8.Text); int i = cmd.ExecuteNonQuery(); if (i == 1) { Label2.Visible = true; Label2.Text = "Record Inserted Successfully"; } }}----------------------------------------WEB.CONFIG