|
-
Jul 28th, 2011, 02:58 PM
#1
Thread Starter
Lively Member
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
-
Jul 28th, 2011, 05:20 PM
#2
Member
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:
' Going to assume that your combobox is populating from a datatable where the value is an ID ' and the selected text is some field value - cmbDropDown1 is the combo box. Dim intComboBoxValue as Integer = cType(cmbDropDown1.selectedItem, datarowview).item("ID") ' Set the SQL to insert Dim strSQL as string = "INSERT INTO TABLE (field1, field2) VALUES ("+ intComboBoxValue.toString +", Now())"
-
Aug 2nd, 2011, 03:32 AM
#3
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|