示例#1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            MainMenu        frm  = new MainMenu();
            List <object[]> data = new List <object[]>();

            data = frm.get_data_table_string_like("tbasfis", "speciesname", txtsearch.Text.Trim());
            if (data.Count > 0)
            {
                dataGridView1.Rows.Clear();
                dataGridView1.Rows.Add(data.Count);

                for (int i = 0; i < data.Count; i++)
                {
                    dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString();
                    dataGridView1.Rows[i].Cells[1].Value = data[i][0].ToString();


                    if (data[i][1] == null)
                    {
                        dataGridView1.Rows[i].Cells[2].Value = "";
                    }
                    else
                    {
                        dataGridView1.Rows[i].Cells[2].Value = data[i][1].ToString();
                    }


                    if (data[i][2] == null)
                    {
                        dataGridView1.Rows[i].Cells[3].Value = "";
                    }
                    else
                    {
                        dataGridView1.Rows[i].Cells[3].Value = data[i][2].ToString();
                    }
                }
            }
        }
示例#2
0
        private void search_hts(String products)
        {
            List <object[]> datahts;
            MainMenu        frm     = new MainMenu();
            String          product = txtproductdescription.Text.Trim();

            datahts = frm.get_data_table_string_like("tb_htsproduct", "commodity_description", product);
            if (datahts.Count > 0)
            {
                dghts.Rows.Clear();
                dghts.Rows.Add(datahts.Count);
                for (int i = 0; i < datahts.Count; i++)
                {
                    dghts.Rows[i].Height         = 40;
                    dghts.Rows[i].Cells[0].Value = (i + 1).ToString();
                    dghts.Rows[i].Cells[1].Value = datahts[i][1].ToString();
                    dghts.Rows[i].Cells[2].Value = datahts[i][2].ToString();
                    dghts.Rows[i].Cells[3].Value = datahts[i][3].ToString();
                }

                select_columnbutton();
            }
        }