I have a database that stores invoice information. Each invoice can have up to 5 jobs relation, each job has a unique id number.
I've performed a select statement selecting all jobs relevant to a single invoice.
I have tried many ways to read the selected job id and store them in a jobArray. I would prefer to have it selecting using a for loop but most of the ways I've tried use textBoxes (which I replaced with my array)
This is my most recent code;
     SqlCeCommand cmdCountJobs = new SqlCeCommand("SELECT COUNT(Job_ID)AS INVCOUNT FROM Invoice WHERE Invoice_Number = " + maxInvoice + " ", cn);
        cmdCountJobs.Connection = cn;
        reader = cmdCountJobs.ExecuteReader();
        while (reader.Read())
        {
            countValue = Convert.ToInt32(reader["INVCOUNT"].ToString());
        }         
        SqlCeCommand cmdJobSearch = new SqlCeCommand("SELECT Job_ID as ID FROM Invoice WHERE Invoice_Number = " + maxInvoice + " ", cn);
        cmdJobSearch.Connection = cn;
        reader = cmdJobSearch.ExecuteReader(); 
        SqlCeDataAdapter da = new SqlCeDataAdapter(cmdJobSearch);
        jobArray[0] = (reader.Read()) ? reader["ID"].ToString() : "";
        jobArray[1] = (reader.Read()) ? reader["ID"].ToString() : "";
        jobArray[2] = (reader.Read()) ? reader["ID"].ToString() : "";
        jobArray[3] = (reader.Read()) ? reader["ID"].ToString() : "";
        jobArray[4] = (reader.Read()) ? reader["ID"].ToString() : "";   
        }
Could you help me with this?
 
     
     
    