Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can save data in table in database for multiple checkboxes in pl/sql.
Posted
Updated 27-May-11 2:08am
v2
Comments
That's Aragon 27-May-11 8:09am    
Tag changed from "Oracle" to "SQL" as question is for PL/SQL

1 solution

You can save checkboxes value with comma separate.

C#
string SelectedValue = string.Empty,blankValue=string.Empty;
                foreach (ListItem item in chklist.Items)
                {
                    if (item.Selected)
                    {
                        SelectedValue += item.Value + ",";
                    }
                    else
                    {
                        blankValue += item.Value + ",";
                    }
                }


Please note that this code is for CheckBoxList and not for CheckBox.

I have provided this solution as you have mentioned multiple checkboxes. So I assume that checkboxes are related items.

[Edit Start]
You need to follow some steps to save the value of selectedValue variable to SQL database.
1. Create a table with appropriate fields name and data type
2. Add a column for checkboxIds of varchar type
3. Create a store procedure with insert query which save the passed selectedvalue parameter in table
4. Create a function in your application, which will accept the parameter and passed it to the store procedure
5. Call this function and pass the variable SelectedValue

NOTE : In the question you have write PL/SQL and you have tag it for Oracle. So I have changed it to the SQL.
[Edit End]
 
Share this answer
 
v2
Comments
nitendrasingh 27-May-11 5:31am    
but how we store it in database that i can see it in report.
That's Aragon 27-May-11 8:09am    
Please review my edited response.

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