Results 1 to 3 of 3

Thread: capturing form/combo box data to mysql

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Location
    UK - OK
    Posts
    72

    capturing form/combo box data to mysql

    Hi all...

    Im trying to capture the result of a combo box and time/date stamp this to mysql. I have a working connection between the form and the db\table can anyone tell me how to achieve this?

    Thanks


  2. #2
    Member
    Join Date
    Oct 2008
    Posts
    40

    Re: capturing form/combo box data to mysql

    If you are populating the combo box from your database in the first instance, use something along the lines of:

    vb Code:
    1. ' Going to assume that your combobox is populating from a datatable where the value is an ID
    2. ' and the selected text is some field value - cmbDropDown1 is the combo box.
    3. Dim intComboBoxValue as Integer = cType(cmbDropDown1.selectedItem, datarowview).item("ID")
    4.  
    5. ' Set the SQL to insert
    6. Dim strSQL as string = "INSERT INTO TABLE (field1, field2) VALUES ("+ intComboBoxValue.toString +", Now())"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2011
    Location
    UK - OK
    Posts
    72

    Re: capturing form/combo box data to mysql

    Hi,

    Thanks for this... Being a noob to this Im not really getting it. When you say the value is an ID, do you mean this is the value its putting into the combo box from the sql table?

    Where in this code am I specifying the table I wish to use within the mysql db? The actual table name is "User Details" where the fields I want to capture in the drop down list are "First Name" and "Surname" is it possible to capture 2 fields or would I combine them first within the mysql db?

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width