Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i show all the count of my zero in label i have a connection like this

public void countMinor()
        {
            var ExcelPath2 = Application.StartupPath + "\\DB\\" + ConfigurationManager.AppSettings["ExcelDBPrize"];
            DataSet ds = new DataSet();
            OleDbConnection cn = null;
            OleDbDataAdapter cmd2 = null;
            cn = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source= " + ExcelPath2 + ";Extended Properties='Excel 12.0 XML;HDR=Yes;IMEX=1;'; ");
            cn.Open();
            cmd2 = new OleDbDataAdapter("SELECT COUNT(Status) AS STAT FROM [Sheet1$] WHERE Status = 0", cn);
            cmd2.Fill(ds);

            //lblMinor.Text = cmd2.ToString();
            cn.Close();
            //lblprizeno.Text = ds.Tables[0].Rows[randomprize][0].ToString();
        }

i gonna use this in load form but the count doesn't appear.

What I have tried:

i tried to search this but i can't find my exact answer
Posted
Comments
Richard MacCutchan 3-Dec-18 5:02am    
What information is returned by the SELECT command?
CHill60 3-Dec-18 5:08am    
You haven't put the result anywhere to appear ... debug to find the contents of ds and then show the results
ZurdoDev 4-Dec-18 15:01pm    
I see code that looks like it should do what you want, other than actually displaying the value. So, where are you stuck? What did you want us to do?

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