locked
Storing value from GridView to Database using checkbox RRS feed

  • Question

  • User968394008 posted

    Hi all,

             I am unable to find a method where I can store data from gridview to database.

            My concerns is There are four columns in gridview namely Roll No, Name, Present and Absent. Present and Absent have checkboxes, so I want to store these values in a seperate database with only three columns. As Roll_No, Name, Status so im worried about how I can get it done. Any type of help would be highly appreciated

    Friday, February 16, 2018 10:46 AM

All replies

  • User-707554951 posted

    Hi dev_rahul

    You could foreach gridview to get Roll_No, Name and Status(Check Present checked or not), If Present is checked, Status value is true.

    Otherwise it’s value is false.

    Related thread for reference:

    https://stackoverflow.com/questions/30139797/how-to-save-gridview-each-row-value-in-table

    Best regards

    Cathy

    Monday, February 19, 2018 9:55 AM
  • User269602965 posted

    Depends on database and whether you are using SQL or the database procedural language for doing the insertion.

    Oracle SQL does not support Boolean datatypes, but the Oracle PL/SQL (database procedure) does; however the target Oracle data table does not support Boolean datatype.

    The desired effect can be accomplished by the SQL statement (with conversion of Boolean to text) or the PL/SQL procedure.

    Given that you are transforming two columns into one, and the value being passed is classically Boolean for Checkbox.IsChecked, for Oracle the INSERT would best be done in the Database Procedural side. 

    How that is done, again depends on the database being called due to differences in each database.

    So first determine the datatype capabilities of your target database.

    Tuesday, February 20, 2018 4:30 AM