
- Forum
- Programming Talk
- Microsoft .NET
- Inserting checkbox values into one field
Inserting checkbox values into one field
This is a discussion on Inserting checkbox values into one field within the Microsoft .NET forums, part of the Programming Talk category; Hi I have a checkboxes on my page (.aspx) like checkbox1 - item1 checkbox2 - item2 checkbox3 - item3 etc ...
-
Inserting checkbox values into one field
Hi
I have a checkboxes on my page (.aspx) like
checkbox1 - item1
checkbox2 - item2
checkbox3 - item3
etc
what i want is that when a user selects certain checkboxes
they should be inserted into a table called
customer which has fields (customer id and actions)
the data should be inserted as
customerid actions
1 item1,item2,item3
2 item1,item3
3 etc..
i.e all the values should be inserted into database into one field separated by commas.
Thanks
-
Have u written any data insertion part..? I mean in SQL or something?
-
-
hi,
I can help u out but i need need sum clarifications.. If my understanding is correct then its merely database table updations.. If I know the employee id of the users.. then i can use the select statement to search the table entry n read the action column value from the matching record.. then append it with the corresponding item.. finally use the update query to make the updation back to the database table..
sqlconnection con = new connection("give the connection string here");
sqlcommand cmdSelect = new sqlcommand("select action from customer where custid= "+ cust_id,con);// cust_id is the id of the corresponding user
if(cmdSelect.executescalar() != string.empty)
{
sqlcommand cmdUpdate = new sqlcommand("udate customer set action = action" + "," + item + " where custid = "+cust_id,con);
cmdUpdate.executeNonQuery();
}
Note:
The keyword casing is not properly given..
with Regards,
Anand Kumar .I
-
Sponsored Ads

Reply With Quote






