Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to relate a selected checkboxs to columns of a table in the SQL data base. Any good solution to this using ASP?

This is how I am pop column names into the checkbox list:
VB
asp:SqlDataSource ID="Columns" runat="server"
            ConnectionString="<%$ ConnectionStrings:myDB %>" SelectCommand="SELECT COLUMN_NAME
FROM [InterBC-WeatherStation].INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='Products' AND (
      COLUMN_NAME = 'Employee' OR
      COLUMN_NAME = 'Salary' OR...
Posted
Updated 18-Apr-11 6:19am
v2

1 solution

Well
1) your database should be a boolean
2) the checkbox value should always be converted into boolean. So your code would be something like
insert into mytable values (" + checkbox1.value + "....

This was not code that compiles - just a sample.

Checkbox.Checked contains true or false as follows[^].
 
Share this answer
 
Comments
jalmonte 18-Apr-11 15:37pm    
Sorry for the misunderstanding. But I want to populate the table that is on the GridView with the values that are located in the database. (depending on the checkbox selected which correspond to the columns)

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