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;

        }

You can check it like this:

string[] ProposalNumbers = getProposalNumbers();

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

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.