Hi,
try  "select COUNT(*) from CleaningStatus where Status = 'Cleaning'".

If that wont work... Is there any error/exception message?

On Wed, Aug 12, 2009 at 4:27 PM, stanlei <[email protected]> wrote:

>
> i've made a form which is supposed to display the result from
>
>  "select COUNT() from CleaningStatus where Status = 'Cleaning'"
> query
>
> ive tried :
>
> SqlConnection connection = new SqlConnection();
>                connection.ConnectionString =
>                    "Data Source = moi-pc/SQLEXPRESS; Initial Catalog
> = Project; User ID = sa ;Password = madurai";
>                connection.Open();
>                SqlDataReader myReader = null;
>                query = "select COUNT() from CleaningStatus where
> Status = 'Cleaning'";
>                SqlCommand myCommand = new SqlCommand(mainquery,
> connection);
>                SqlCommand myCommand2 = new SqlCommand
> (query1,connection);
>
>                myCommand.Parameters.Add(new SqlParameter());
>                SqlDataReader dr = myCommand.ExecuteReader();
>
>
>                userCount = (int)myCommand.ExecuteScalar();
>
>
>                while (dr.Read())
>
>                while (myReader.Read())
>                {
>                    userCount = Convert.ToInt32(textBox3.Text);
>                    textBox3.Text = myReader[1].ToString();
>
>                }
>            }
>            catch
>            {
>                Console.WriteLine("failed");
>            }
>
> BUT i dont think im getting anywhere
>
> any help will be greatly appreciated
>

Reply via email to