We help IT Professionals succeed at work.

update mysql table from excel sheet

472 Views
Last Modified: 2012-08-13
Hi,

I'm wondering how I can update a mysql table from an excel sheet. Do I need some VB script?

Thank you,
Victor
Comment
Watch Question

You can do it from vbscript, VBA Excel or SQL itself :)

Sid
Sorry, I just notice it it mysql.

Would you like a VBA Excel code?

Sid
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Victor KimuraSEO, Web Developer

Author

Commented:
Hi SiddharthRout,

Thank you for the info. Sorry, I'm still new to VB coding. Just a few questions:

1) How do I reference Microsoft ActiveX Data Objects Library? Do I have to download the library or is it already installed?

2) This line:
FIELD1VALUE = .Range("A" & i).Value

Open in new window


I'm just wondering what the i in the brackets is.

3)  What is adLockOptimistic? Is this to lock the table while it's inserting?

Thank you,
Victor
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Victor KimuraSEO, Web Developer

Author

Commented:
Hi SiddharthRout,

I receive this error after the line cn.Open = line. update mysql table runtime error
>>>I receive this error after the line cn.Open = line.

   '~~> Update as required
    cn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=localhost;" & _
        "DATABASE=yourdatabase;" & "USER=yourdbusername;" & _
        "PASSWORD=yourdbpassword;" & "Option=3"

Please some me the code that you are using in that line. I hope you have amended it as I suggested in the code.

Sid
Victor KimuraSEO, Web Developer

Author

Commented:
Hi,

I have this:
    '~~> Update as required
    cn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=localhost;" & _
        "DATABASE=test;" & "USER=root;" & _
        "PASSWORD=8469lovingJesus;" & "Option=3"

I had it updated. I'm still receiving the error. The settings (server, db name, user, password) are correct. I believe the driver name is correct but I'm not certain.

Much thanks,
Victor
Victor KimuraSEO, Web Developer

Author

Commented:
Hi broomee9,

I think you should reword your request to something that is more euphemistic (i.e. kinder and gentler). The words you use seem to convey a condemning attitude. Please remember that we are paying members and without the paying members this would be simply another forum.
CERTIFIED EXPERT

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.