private void DataGrid2_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { display2(); SqlCommand cmd = new SqlCommand("select * from adminbanner", con); cmd.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "adminbanner"); con.Open(); DataView dv = new DataView(ds.Tables["adminbanner"]); if ((numberdiv % 2) == 0) { dv.Sort = e.SortExpression + " " + "ASC"; } else { dv.Sort = e.SortExpression + " " + "DESC"; } numberdiv++; DataGrid2.DataSource = dv; DataGrid2.DataBind(); }
protected void Grid_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid2.CurrentPageIndex = e.NewPageIndex; if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.titre WHERE titre.codeuser='******' AND titre.numzone='C12' UNION SELECT * FROM database.detail WHERE detail.codeuser='******' AND detail.numzone='C12' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } } } } } }
void BindGrid() { DataGrid1.DataSource = dtv1; DataGrid1.DataBind(); DataGrid2.DataSource = dtv2; DataGrid2.DataBind(); }
private void BindStorage() { DataTable dtStorage = Helper.Query("select * from tbStorage where cnnCount>0 and cnvcStorageDeptID='" + ddlProduceDept.SelectedValue + "'"); DataGrid2.DataSource = dtStorage; DataGrid2.DataBind(); }
private void EstDeptStgDataBinding(int ver_id, int estterm_ref_id, int est_dept_ref_id) { Biz_PDTAndAHPStgEstDeptDatas pdtAhpEstDept = new Biz_PDTAndAHPStgEstDeptDatas(); DataSet ds = pdtAhpEstDept.GetPDTAndAHPEstDeptStgList(ver_id , estterm_ref_id , est_dept_ref_id , "Y"); DataGrid2.DataSource = ds; DataGrid2.DataBind(); lblStgCount.Text = ds.Tables[0].Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 1) { DataGrid1.Visible = false; DataGrid3.Visible = false; iBtnSave.Visible = false; } else { DataGrid1.Visible = true; DataGrid3.Visible = true; iBtnSave.Visible = true; } }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { id = e.Item.Cells[0].Text; if (e.CommandName == "su") { MultiView1.SetActiveView(View2); DataGrid2.DataSource = db.DataReturn("select * from surgeons where hospital_id='" + id + "'"); DataGrid2.DataBind(); } if (e.CommandName == "sr") { MultiView1.SetActiveView(View3); DataGrid3.DataSource = db.DataReturn("select * from surgeries inner join surgery_category on.surgeries.category_id=surgery_category.category_id where hospital_id='" + id + "'"); DataGrid3.DataBind(); } if (e.CommandName == "a") { string qry = "update login set user_type='hospital' where login_id='" + e.Item.Cells[1].Text + "'"; db.DataNonReturn(qry); Response.Write("<script>alert('Approved Successfully !!!');window.location='admin_hospitals.aspx'</script>"); } if (e.CommandName == "r") { string qry = "update login set user_type='Rejected' where login_id='" + e.Item.Cells[1].Text + "'"; db.DataNonReturn(qry); Response.Write("<script>alert('Rejected Successfully !!!');window.location='admin_hospitals.aspx'</script>"); } }
protected void BindGrid2() { if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.activite WHERE activite.iduser='******' AND activite.nature='Arts ou artisanat'")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } } } } } }
protected void Page_Load(object sender, EventArgs e) { //Establish the database connection using (SqlConnection Connect = new SqlConnection("data source=.;database=assignment;integrated security= SSPI")) { SqlDataAdapter SDA = new SqlDataAdapter("Select * from students", Connect); //to retrive the data from database- student created SqlDataAdapter SDA1 = new SqlDataAdapter("Select * from Employee", Connect); //to retrive the data from database- student created SqlDataAdapter SDA2 = new SqlDataAdapter("Select * from CricketTeam", Connect); //to retrive the data from database- student created SqlDataAdapter SDA3 = new SqlDataAdapter("Select * from IRS", Connect); //to retrive the data from database- student created SqlDataAdapter SDA4 = new SqlDataAdapter("Select * from Bank_EmployeeDetails", Connect); //to retrive the data from database- student created DataSet ds = new DataSet(); //to convert the data into the grid. DataSet ds1 = new DataSet(); //to convert the data into the grid. DataSet ds2 = new DataSet(); //to convert the data into the grid. DataSet ds3 = new DataSet(); //to convert the data into the grid. DataSet ds4 = new DataSet(); //to convert the data into the grid. SDA.Fill(ds); SDA1.Fill(ds1); SDA2.Fill(ds2); SDA3.Fill(ds3); SDA4.Fill(ds4); DataGrid1.DataSource = ds; DataGrid1.DataBind(); DataGrid2.DataSource = ds1; DataGrid2.DataBind(); DataGrid3.DataSource = ds2; DataGrid3.DataBind(); DataGrid4.DataSource = ds3; DataGrid4.DataBind(); DataGrid5.DataSource = ds4; DataGrid5.DataBind(); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text == "Food") { MultiView1.SetActiveView(View2); cmd.CommandText = "select *from food_tb"; DataGrid1.DataSource = db.getdata(cmd); DataGrid1.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Hotel") { MultiView1.SetActiveView(View3); cmd.CommandText = "select *from Hotel_tb"; DataGrid2.DataSource = db.getdata(cmd); DataGrid2.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Place") { MultiView1.SetActiveView(View4); cmd.CommandText = "select *from Place_tb"; DataGrid3.DataSource = db.getdata(cmd); DataGrid3.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Others") { MultiView1.SetActiveView(View5); cmd.CommandText = "select *from Image_tb"; DataGrid4.DataSource = db.getdata(cmd); DataGrid4.DataBind(); } }
private void DataGrid2_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { //con = new SqlConnection("server=SUTHAHAR-F92F17\\TEST;database=sample;user id=sa;pwd=sukitha"); display2(); SqlCommand cmd = new SqlCommand("select * from adminradio", con); cmd.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "adminradio"); con.Open(); DataView dv = new DataView(ds.Tables["adminradio"]); if ((numberdiv % 2) == 0) { dv.Sort = e.SortExpression + " " + "ASC"; } else { dv.Sort = e.SortExpression + " " + "DESC"; } numberdiv++; DataGrid2.DataSource = dv; DataGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection connect = new SqlConnection("server=DESKTOP-NOQ9PCB\\MSSQLSERVER01;database=DxcTraining; integrated security=true")) { SqlDataAdapter sda = new SqlDataAdapter("select * from student1", connect); DataSet ds = new DataSet(); sda.Fill(ds); DataGrid1.DataSource = ds; DataGrid1.DataBind(); SqlDataAdapter sda1 = new SqlDataAdapter("select * from Employee2", connect); DataSet ds1 = new DataSet(); sda1.Fill(ds1); DataGrid2.DataSource = ds1; DataGrid2.DataBind(); SqlDataAdapter sda2 = new SqlDataAdapter("select * from IndianCricketTeam", connect); DataSet ds2 = new DataSet(); sda2.Fill(ds2); DataGrid3.DataSource = ds2; DataGrid3.DataBind(); SqlDataAdapter sda3 = new SqlDataAdapter("select * from IndianRailwaySystem1 ", connect); DataSet ds3 = new DataSet(); sda3.Fill(ds3); DataGrid4.DataSource = ds3; DataGrid4.DataBind(); SqlDataAdapter sda4 = new SqlDataAdapter("select * from BankTable", connect); DataSet ds4 = new DataSet(); sda4.Fill(ds4); DataGrid5.DataSource = ds4; DataGrid5.DataBind(); } }
public void BindGridP2() { //为Panel2的数据 DataSet ds2 = SqlHelper.ExecuteDs("SELECT * FROM HK_POLL_KEY WHERE SUBID='" + codelbl.Text + "' ORDER BY KEYID"); DataGrid2.DataSource = ds2; DataGrid2.DataBind(); }
void grid2() { string b = "select * from fertilizerdetails"; DataTable dt = db.ret(b); DataGrid2.DataSource = dt; DataGrid2.DataBind(); }
public void BindData() { string s = "select Qry_Text,Qry_Sol from tblqrydetails where Qry_Sol is not null and Qry_sol not like ''"; ds = b.Ex_DRL(s); DataGrid2.DataSource = ds; DataGrid2.DataBind(); }
public void DataBind2() { SqlDataAdapter apt = new SqlDataAdapter("select empid,empname from crm_empreg", con); DataSet ds = new DataSet(); apt.Fill(ds); DataGrid2.DataSource = ds; DataGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT fault_prediction.mechine_id, fault_prediction.fault_id, mechine_management.mechine_name, fault_prediction.technician_id, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.technician_id = employee_management.employee_id WHERE (fault_prediction.worker_id = 1)"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
private void loadNumber(string list_code) { MultiView2.ActiveViewIndex = 2; int list_id = int.Parse(list_code); data_table = data_file.GetActiveListNumbers(list_id); DataGrid2.DataSource = data_table; DataGrid2.DataBind(); }
private void GetByProductType() { if (cboSearchType0.SelectedValue == "0" || cboSearchType0.SelectedValue == "") { cboSearchType0.SelectedValue = "1"; } DataGrid2.DataSource = dh.GetByProductType(int.Parse(cboSearchType0.SelectedValue)); DataGrid2.DataBind(); Label5.Text = "Monthly Performance of: " + cboSearchType0.SelectedItem.ToString(); Label6.Text = "Top performing: " + cboSearchType0.SelectedItem.ToString(); }
void binddetailsgrid(int positionid) { string q = "select * from position where positionid=@pos"; SqlCommand cmd = new SqlCommand(q, connection); cmd.Parameters.AddWithValue("@pos", positionid); connection.Open(); DataGrid2.DataSource = cmd.ExecuteReader(); DataGrid2.DataBind(); connection.Close(); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "view") { Session["msgid"] = e.Item.Cells[5].Text; to.Text = e.Item.Cells[0].Text.ToString(); MultiView1.SetActiveView(View2); string a = "select msg from message where fromid=" + e.Item.Cells[0].Text + ""; DataGrid2.DataSource = db.ret(a); DataGrid2.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MultiView1.SetActiveView(View2); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from auditorium "; DropDownList7.DataSource = a.getdata(cmd); DropDownList7.DataTextField = "aname"; DropDownList7.DataValueField = "aid"; DropDownList7.DataBind(); DropDownList7.Items.Insert(0, "--select--"); for (int i = 1; i <= 31; i++) { DropDownList1.Items.Add(i.ToString()); } DropDownList1.Items.Insert(0, "Day"); for (int i = 1; i <= 12; i++) { DropDownList2.Items.Add(i.ToString()); } DropDownList2.Items.Insert(0, "Month"); for (int i = 2018; i <= 2050; i++) { DropDownList3.Items.Add(i.ToString()); } DropDownList3.Items.Insert(0, "Year"); for (int i = 1; i <= 31; i++) { DropDownList4.Items.Add(i.ToString()); } DropDownList4.Items.Insert(0, "Day"); for (int i = 1; i <= 12; i++) { DropDownList5.Items.Add(i.ToString()); } DropDownList5.Items.Insert(0, "Month"); for (int i = 2018; i <= 2050; i++) { DropDownList6.Items.Add(i.ToString()); } DropDownList6.Items.Insert(0, "Year"); cmd.CommandText = "select * from bookingreg where uid=" + Session["id"] + " and status='pending'"; DataGrid2.DataSource = a.getdata(cmd); DataGrid2.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update fault_prediction set time = '" + TextBox6.Text + "',status='process' where fault_id='" + Label1.Text + "'"; obj.execute(cmd); Response.Write("<script>alert('Time is Set')</script>"); cmd.CommandText = "SELECT fault_prediction.mechine_id, fault_prediction.fault_id, mechine_management.mechine_name, fault_prediction.technician_id, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.technician_id = employee_management.employee_id WHERE (fault_prediction.worker_id = 1)"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
protected void DataGrid2_ItemCommand(object source, DataGridCommandEventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update fault_prediction set status='finish' where fault_id='" + e.Item.Cells[0].Text + "'"; obj.execute(cmd); Response.Write("<script>alert('Finish success')</script>"); cmd.CommandText = "SELECT fault_prediction.fault_id, mechine_management.mechine_name, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status, fault_prediction.mechine_id, fault_prediction.worker_id FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.worker_id = employee_management.employee_id WHERE (fault_prediction.technician_id = '" + Session["id"] + "') AND (fault_prediction.status = 'process')"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { id = Convert.ToInt32(e.Item.Cells[0].Text); if (e.CommandName == "v") { MultiView1.SetActiveView(View2); cmd = new SqlCommand(); dt = new DataTable(); cmd.CommandText = "select * from order_details od,product p where od.ormas_id='" + id + "' and od.product_id=p.product_id"; dt = con.data_return(cmd); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select max(cmp_id)from complaints"; id = obj.max_id(cmd); cmd.CommandText = "insert into complaints values('" + id + "','" + Session["id"] + "','technician','" + TextBox2.Text + "','pending','" + TextBox3.Text + "')"; obj.execute(cmd); TextBox2.Text = ""; TextBox3.Text = ""; cmd.CommandText = "select * from complaints where type='Technician' and employee_id= '" + Session["id"] + "'"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View2); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { if (DropDownList1.SelectedValue != "0") { DataGrid2.DataSource = dh.GetsalesReport(DropDownList1.SelectedItem.ToString()); DataGrid2.DataBind(); } } catch (Exception ex) { Message(ex.Message, true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT bookingreg.bid, user_reg.name, bookingreg.fr_date, bookingreg.to_date, bookingreg.time, package.package, bookingreg.total_amt FROM bookingreg INNER JOIN user_reg ON bookingreg.uid = user_reg.uid INNER JOIN package ON bookingreg.pkg_id = package.pgid and bookingreg.aid=" + Session["id"] + ""; DataGrid2.DataSource = a.getdata(cmd); DataGrid2.DataBind(); cmd.CommandText = "SELECT hour_booking.hid, user_reg.name, hour_booking.date, hour_booking.start_time, hour_booking.end_time, hour_booking.amount FROM hour_booking INNER JOIN user_reg ON hour_booking.uid = user_reg.uid and hour_booking.aid=" + Session["id"] + ""; DataGrid3.DataSource = a.getdata(cmd); DataGrid3.DataBind(); MultiView1.SetActiveView(View1); } }
protected void DataGrid2_ItemCommand(object source, DataGridCommandEventArgs e) { SqlCommand cmd = new SqlCommand(); if (e.CommandName == "cancel") { cmd.CommandText = "update bookingreg set status='cancelled' where bid=" + e.Item.Cells[0].Text + ""; a.execute(cmd); Response.Write("<script>alert('Cancelled booking')</script>"); } cmd.CommandText = "select * from bookingreg where uid='" + Session["id"] + "'"; DataGrid2.DataSource = a.getdata(cmd); DataGrid2.DataBind(); }
public void paging(object o, DataGridPageChangedEventArgs e) { try { string s = "select Qry_Text,Qry_Sol from tblqrydetails where Qry_Sol is not null"; DataGrid2.CurrentPageIndex = e.NewPageIndex; ds = b.Ex_DRL(s); DataGrid2.DataSource = ds; DataGrid2.DataBind(); } catch (Exception ex) { throw new ArgumentException(ex.Message); } }
private void GetTotalSales() { int Sales = 0; int cost = 0; int profit = 0; Sales = int.Parse(dac.GetTotalSales().Rows[0]["Sales"].ToString()); Label2.Text = String.Format("{0:#,###,###.##}", Sales); cost = int.Parse(dac.GetTotalSales().Rows[0]["Cost"].ToString()); Label3.Text = String.Format("{0:#,###,###.##}", cost); profit = int.Parse(dac.GetTotalSales().Rows[0]["Profit"].ToString()); Label4.Text = String.Format("{0:#,###,###.##}", profit); DataGrid2.DataSource = dac.GetTotalreports(); DataGrid2.DataBind(); }