Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All

I recently been tasked with rewriting my borland 2006 c++ into c#. I have drawn the checkboxes and is 55 or so checkboxes. The checboxes ought to be linked to the 11g database and they get their values (names, labels, checked or unchecked) from the database on a remote server. DOes anyone have any idea how i could do this. I am connecting to an oracle database and i have allready:

C#
using Oracle.DataAccess.Client;
string oradb = "Data Source=";
            oradb = oradb + Login.db + ";";
            oradb = oradb + "User Id=" + Login.user;
            oradb = oradb + ";Password=" + Login.pass + ";";
            OracleConnection conn = new OracleConnection(oradb);
            conn.Open();
            
string sql = "SELECT PROGRAM_FIELD,DBFIELD, ACTIVE, S.PROGRAM_LABEL FROM GENDBA.SUPTALLYACTIVITIESCONFIG S where active = 'Y' and gcos_schema = '" + frmSchema.schema +"'";

            OracleCommand cmd = new OracleCommand(sql, conn);
            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();
            dr.Read();


after the dr I'm sort of stuck. I appreciate any help you could provide.

ps: as a matter of interest the schema has 4 different schemas and each schema has different values for the same checkbox. in total we have 189 rows combining all 4 schemas.

Thank you in advance
Posted
Updated 5-Jul-11 1:31am
v2

Its better to use XML for populating controls dynamically
How ever with Oracle you can do it
like
chkbox1.checked = dr["name"].value
 
Share this answer
 
does this mean that i will have to do this for all checkboxes?
 
Share this answer
 
Comments
Syed Salman Raza Zaidi 5-Jul-11 7:40am    
yes
Here's the sample,i want to populate a checkbox value according to Gridview's selected row's 9th cell value so i did this ===>
string valuechk = dataGridView1.CurrentRow.Cells[9].Value.ToString ();
              bool chkvalue = Convert.ToBoolean(valuechk);

              if(chkvalue ==false)
                   assignchk.Checked = false;//check box value assigning
               else
                   assignchk.Checked = true;

Now make your code as per your requirementHeres
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900