How checkBox populates the listBox?
I have a database, which has atable called Company. Inside are columns with the basic informations (company name, street, post, city, tel.numbers, ...).
I would like to know to populate listBox with company names which have a "stationary number" in the database when checkBox is checked!
But I mean if the column "StationaryNumber" is NULL, then this comany shouldn`t be included in the listBox, if the company has a number (column is NOT NULL) then the name of the is company MUST be incuded in the listBox!
I have this example for a textBox:
cmd.Parameters.Add(new SqlParameter("@stationary", System.Data.SqlDbType.VarChar, 40, "Stationary"));
cmd.Parameters["@stationary"].Value = textBox.Text;
..let` say if I write in the textBox a telephone number which is in the StationaryNumber column,
it will populate the listBox with the companies which have this number(it should be just one company).
But, if I want to put a checkBox like:
cmd.Parameters.Add(new SqlParameter("@stationary", System.Data.SqlDbType.VarChar, 40, "Stationary"));
cmd.Parameters["@stationary"].Value = ??; //OR this whole row is wrong - it has to be bind to the "Stationary" Column somehow.
... How to code these 2 last lines that the readed will read from a database (column "StationaryNumber")
... What has to be instead of ??? to get into my listBox all the company names,
which have the telephone number in Stationary column
For a better idea what I am doing, take a look at THIS picture. In the buttom right you will notice checkBoxes. This is what I wanna do.
There is example of choosing just number which starts with 080, or 090 or stationary number ,...
Answers
Know the answer? Post it. Somebody with the same question will find it here.