Click here to Skip to main content
15,923,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void button4_Click(object sender, EventArgs e)
            {
                if (txtcombo.Text == "Form ID")
                { 
                    label1.Hide();
                    Global.Open_DataConn("doc", "conData");
                    OleDbDataAdapter da = new OleDbDataAdapter("SELECT WCDCH.formid, WCDCH.surname, WCDCH.firstname, WCDCH.midname, WCDCH.ttransid FROM WCDCH INNER JOIN bankdata ON WCDCH.formid = bankdata.formid", Global.conData);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0];
                    label2.Show();
label3.Text = dataGridView1.RowCount.ToString();
                }
                else if (txtcombo.Text == "TransactionID")
                {
                    label2.Hide();
                    Global.Open_DataConn("doc", "conData");
                    OleDbDataAdapter da = new OleDbDataAdapter("SELECT WCDCH.formid, WCDCH.surname, WCDCH.firstname, WCDCH.midname, WCDCH.ttransid FROM WCDCH INNER JOIN bankdata ON WCDCH.ttransid = bankdata.ttransid", Global.conData);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0];
                    label1.Show();
label3.Text = dataGridView1.RowCount.ToString();
                }
                else
                {
                    MessageBox.Show("Please,Select which you want");
                }
            }

i have done the get matching record from the database in datagrid now i need to count the result shown in the datagrid..
Posted
Updated 16-Jun-12 0:39am
v3

simple use number of rows in tables like
C#
int noofRec ds.Tables[0].rows.count;
 
Share this answer
 
label3.Text = dataGridView1.RowCount.ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900