protected void Page_Load(object sender, EventArgs e)
    {
        // create the connection, DataAdapter and DataSet
        string         connectionString = WebConfigurationManager.ConnectionStrings["Northwind"].ConnectionString;
        string         sql  = "SELECT TOP 5 EmployeeID, TitleOfCourtesy, LastName, FirstName FROM Employees";
        SqlConnection  conn = new SqlConnection(connectionString);
        SqlDataAdapter da   = new SqlDataAdapter(sql, conn);
        DataSet        ds   = new DataSet();

        // Fill the DataSet and fill the first grid.
        da.Fill(ds, "Employees");
        Datagrid1.DataSource = ds.Tables["Employees"];
        Datagrid1.DataBind();

        // Generate the XML file.
        string xmlFile = Server.MapPath("Employees.xml");

        ds.WriteXml(xmlFile, XmlWriteMode.WriteSchema);

        // Load the XML file.
        DataSet dsXml = new DataSet();

        dsXml.ReadXml(xmlFile);
        // Fill the second grid.
        Datagrid2.DataSource = dsXml.Tables["Employees"];
        Datagrid2.DataBind();
    }
Beispiel #2
0
//Filldata Method
        private void filldata()
        {
            ds = new DataSet();
            da = new SqlDataAdapter("select * from individual_master where individual_id= " + Convert.ToInt32(Session["reg_id"]) + " ", cn);
            da.Fill(ds, "individual");
            Datagrid2.DataSource = ds;
            Datagrid2.DataBind();
        }
Beispiel #3
0
 private void filldata1()
 {
     j  = Convert.ToInt32(Datagrid1.Items[Datagrid1.SelectedIndex].Cells[0].Text);
     da = new SqlDataAdapter("select drug_trial_id,trial_start_date,trial_complet_date,purpose_of_trial,drug_id,trial_result_analy_descr,trial_status from drug_trial_master where individual_id=" + j + "", cn);
     ds = new DataSet();
     da.Fill(ds, "individual_drug");
     Datagrid2.DataSource = ds;
     Datagrid2.DataBind();
 }
 protected void Button2_Click(object sender, System.EventArgs e)
 {
     DataGrid1.Visible = false;
     Datagrid2.Visible = true;
     Button2.Visible   = false;
     Panel2.Visible    = false;
     da = new SqlDataAdapter("select * from drug_reg_master", cn);
     ds = new DataSet();
     da.Fill(ds, "drug_master");
     Datagrid2.DataSource = ds;
     Datagrid2.DataBind();
 }
        protected void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Datagrid2.Visible = true;
            DataGrid1.Visible = false;
            Datagrid3.Visible = false;
            int j = Convert.ToInt32(DataGrid1.Items[DataGrid1.SelectedIndex].Cells[0].Text);

            da = new SqlDataAdapter("select drug_trial_id,trial_start_date,trial_complet_date,purpose_of_trial,drug_id,trial_result_analy_descr,trial_result_analy_descr,trial_status from drug_trial_master where individual_id=" + Session["reg_id"] + " and employee_no=" + j + "", cn);
            ds = new DataSet();
            da.Fill(ds, "drug_trial");
            Datagrid2.DataSource = ds;
            Datagrid2.DataBind();
        }
Beispiel #6
0
        //This is used to show the data in report.
        public void show()
        {
            grdLeg.Visible = true;
            int    x  = 0;
            object op = null;

            System.Data.SqlClient.SqlDataReader rdr = null;
            string sql = "select distinct productid from stock_master";

            // Calls the sp_stockmovement for each product and create one stkmv temp. table.
            dbobj.SelectQuery(sql, ref rdr);
            while (rdr.Read())
            {
                dbobj.ExecProc(OprType.Insert, "sp_stockmovement", ref op, "@id", Int32.Parse(rdr["productid"].ToString()), "@strfromdate", getdate(txtDateFrom.Text, true).Date.ToShortDateString(), "@strtodate", getdate(txtDateTo.Text, true).Date.ToShortDateString());
            }
            rdr.Close();
            dbobj.SelectQuery("select * from stkmv", ref rdr);
            if (rdr.HasRows)
            {
                grdLeg.DataSource = rdr;
                grdLeg.DataBind();
                grdLeg.Visible = false;
            }
            //***********************
            rdr.Close();

            dbobj.SelectQuery("select * from stkmv where category='Ibp grade'", ref rdr);
            if (rdr.HasRows)
            {
                Datagrid1.DataSource = rdr;
                Datagrid1.DataBind();
                Datagrid1.Visible = false;
            }
            rdr.Close();
            dbobj.SelectQuery("select * from stkmv where category='Eicher grade'", ref rdr);
            if (rdr.HasRows)
            {
                Datagrid2.DataSource = rdr;
                Datagrid2.DataBind();
                Datagrid2.Visible = false;
            }
            rdr.Close();
            dbobj.SelectQuery("select * from stkmv where category='Force grade'", ref rdr);
            if (rdr.HasRows)
            {
                Datagrid3.DataSource = rdr;
                Datagrid3.DataBind();
                Datagrid3.Visible = false;
            }
            if (eicher != 0)
            {
                eicher1 = "-" + eicher;
            }
            if (force != 0)
            {
                force1 = "-" + force;
            }
            if (sales1 != 0)
            {
                ibp1 = "-" + sales1;
            }
            grandtotal = sales - sales1 - eicher - force;
            //***********************
            // truncate table after use.
            dbobj.Insert_or_Update("truncate table stkmv", ref x);
        }