Exforsys
+ Reply to Thread
Results 1 to 4 of 4

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 ...

  1. #1
    nicky123 is offline Junior Member Array
    Join Date
    Jun 2009
    Answers
    2

    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


  2. #2
    Avantha is offline Junior Member Array
    Join Date
    Jun 2009
    Answers
    1
    Have u written any data insertion part..? I mean in SQL or something?


  3. #3
    nicky123 is offline Junior Member Array
    Join Date
    Jun 2009
    Answers
    2
    Quote Originally Posted by Avantha View Post
    Have u written any data insertion part..? I mean in SQL or something?
    Hello Avanth,
    Thanks for co-operation but not still written any data insertion part.


  4. #4
    anandfuns is offline Junior Member Array
    Join Date
    Jul 2009
    Answers
    1
    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



Latest Article

Network Security Risk Assessment and Measurement

Read More...