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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Farhan AhmedRank #73 · 25K reputationPosted Aug 22, 2019, 6:26 PM EDT
Chittaranjan SwainRank #216 · 11.3K reputationPosted Aug 22, 2019, 7:12 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 22, 2019, 7:51 PM EDT
Sonu GuptaRank #1,261 · 1.4K reputationPosted Aug 23, 2019, 3:09 AM EDT
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();
Kausar Ali19 reputationPosted Aug 23, 2019, 6:48 PM EDT
Kausar Ali19 reputationPosted Aug 23, 2019, 6:49 PM EDT
Amit MohantyRank #112 · 20K reputationPosted Aug 26, 2019, 3:27 AM EDT
Sonu GuptaRank #1,261 · 1.4K reputationPosted Aug 26, 2019, 3:44 AM EDT
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;
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 9, 2019, 3:26 AM EST