How to count a distinct of item from a database table?
count item(exp: number of laptop,pc) from a database (microsoft sql server 2012) and display it in a textbox or richtextbox in a form in(visual studio 2013) vb.net . thank youuuu friendss...
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
Jaipal ReddyRank #588 · 4.1K reputationPosted Jun 21, 2015, 10:31 PM EDT
The following query returns aDistinct count of laptops. SELECT COUNT(DISTINCT LapTop) AS Count, FROM tbl_Laptop oputput like : 10 To display it in TextBox SqlCommand cmd = new SqlCommand("SELECT COUNT(DISTINCT LapTop) AS Count, FROM tbl_Laptop", con); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); txtBox.text = ds..Tables[0].Rows[1]["columnName"].ToString();Thavaselvan PalanivelRank #2,151 · 661 reputationPosted Jun 21, 2015, 8:30 PM EDT
King Umar106 reputationPosted Jun 21, 2015, 10:59 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 22, 2015, 1:14 AM EDT
King Umar106 reputationPosted Jun 21, 2015, 11:00 PM EDT