Hii sir,
How to count total inserted table number of row from msaccess database and display it into a label using c# ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mageshwaran RPosted Nov 9, 2019, 8:26 AM
Sonu GuptaPosted Aug 26, 2019, 7:44 AM
string connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=your .mdb file;";
string sql = "select COUNT(*) AS StudCount from student";
OleDbConnection connection = new OleDbConnection(connetionString);
OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql, connection);
DataSet ds = new DataSet();
connection.Open();
dataadapter.Fill(ds);
connection.Close();
dataGridView1.DataSource = ds;
Amit MohantyPosted Aug 26, 2019, 7:27 AM
Kausar AliPosted Aug 23, 2019, 10:49 PM
Kausar AliPosted Aug 23, 2019, 10:48 PM
Sonu GuptaPosted Aug 23, 2019, 7:09 AM
OleDbConnection my_con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C\db.accdb");
my_con.Open();
OleDbCommand cmds = new OleDbCommand("select COUNT(*) AS StudCount from student", my_con);
OleDbDataAdapter da = new OleDbDataAdapter(cmds);
DataTable dt = new DataTable();
da.Fill(dt);
lblCounter.Text = dt.Rows[0][" StudCount "].ToString();
Amit MohantyPosted Aug 22, 2019, 11:51 PM
Chittaranjan SwainPosted Aug 22, 2019, 11:12 PM
Farhan AhmedPosted Aug 22, 2019, 10:26 PM