0

hi,
i havea mathod called "getProposalNumbers" which returs a string array. this is filled by the data from the database. what i want is to check whether the array hase no values the mothod code is below.

how can i check whether the array has no values?

please can someone give me an solution to this,
thanxxxxx

appriciate a lot thaxxxx

//Retrieves all the proposal numbers from the Proposal table
        public String[] getProposalNumbers()
        {
            db.openConnection();

            String query = @"Select ProposalNo From Proposal";
            SqlCommand command = new SqlCommand(query, DB.getConnection());

            SqlDataAdapter da = new SqlDataAdapter(command);
            DataTable dt = new DataTable();

            da.Fill(dt);

            int NoOfRows = dt.Rows.Count;
            String[] proposalNo = new String[NoOfRows];


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                proposalNo[i] = dt.Rows[i]["ProposalNo"].ToString();

            }

            db.closeConnection();

            return proposalNo;

        }
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by farooqaaa
0

You can check it like this:

string[] ProposalNumbers = getProposalNumbers();

if (ProposalNumbers.Length > 0)
{
     // Array is not empty
}

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.