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.Data;
public partial class Department : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//to populate the country name in dropdown
if (!IsPostBack)
{
SqlConnection deptConnection = new SqlConnection(“Server=.;Database=Login;trusted_connection=true”);
SqlCommand deptCommand = new SqlCommand(“Select * from Country”, deptConnection); //Country is a table
deptConnection.Open();
SqlDataReader reader = deptCommand.ExecuteReader();
DLocationDropDownList.DataSource = reader;
DLocationDropDownList.DataTextField = “CountryName”;
DLocationDropDownList.DataValueField = “CountryId”;
DLocationDropDownList.DataBind();
}
}
protected void AddDeptButton_Click(object sender, EventArgs e)
{
SqlConnection deptConnection = new SqlConnection(“Server=.;Database=Login;trusted_connection=true”);
SqlCommand addcmd = new SqlCommand(“AddDept”, deptConnection);
addcmd.CommandType = CommandType.StoredProcedure;
deptConnection.Open();
SqlParameter returnParameter = addcmd.Parameters.Add(“@result”, SqlDbType.Int);
returnParameter.Direction = ParameterDirection.ReturnValue;
addcmd.Parameters.AddWithValue(“@DepartmenttName”, DNameTextBox.Text);
addcmd.Parameters.AddWithValue(“@CountryId”, DLocationDropDownList.SelectedValue);
addcmd.Parameters.AddWithValue(“@Discription”, DiscriptiomnTextBox.Text);
addcmd.ExecuteNonQuery();
ResultLabel.Text = addcmd.Parameters[“@result”].Value.ToString();
}
protected void CancelButton_Click(object sender, EventArgs e)
{
Response.Redirect(“Department.aspx”);
}
protected void DLocationDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
A great place to learn how to display data on the web however, .NET languages are object orientated it would be great to consider creating more than one object, such as classes and interfaces….basically creating a re-usable infrastructure which makes it easier the next time you wanna code something similar 🙂 If you need some help let me know….I do this every day 🙂
Thanks waseem for your words!!! 🙂
If you want to be a part of engineer’s world do message me , So that readers can get some good stuff to read and learn.
Thanks
Please tell me about the block diagram for keypad scanner debouncer and decoder, here I am getting confuse about logic equations for decoder i.e, N3=R2C0’+R3C1′
N2=R1+R2C0
N1=R0C0’+R2’C2+R1’R0’C0
N0=R1C1+R1’C2+R3’R1’C1′
also the equations derived from the state graph using a CAD program such as LogicAid are
Q1+=Q1Kd+Q2Q3’K+Q2’Q3K+Q2’Q4
Q2+=Q2’Q3’+K+Q4
Q3+=Q3’+Q1+Q4kd’+Q2’K
Q4+=Q2’+Q1+Q3Kd’+Q3’K
V=KQ2Q3’+KQ2’Q3+Q2’Q4
HERE I AM GETTING CONFUSE THAT HOW TO MEMORIZE THE FOLLOWING EQUATION FOR THE KEYPAD SCANNER DEBOUNCER AND DECODER? PLEASE PROVIDE ME THE LOGIC TO MEMORIZE THOSE EQUTION. THANKING YOU IN ADVANCE