|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
vb6 problem (newbie question)
So I finally figured out how to connect to my mysql database and insert the appropriate fields. I used vb dev. and opened up a standard.exe file and placed the following code which was assigned to a button. Every time that I click the button, it inserts the values into my database. (it works)
---------------------- Private Sub Command1_Click() 'set up the connection to my table Dim conn As New ADODB.Connection conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=phone_number;UID=root;PWD=legend;" conn.CursorLocation = adUseClient conn.Open 'inserts the values in the database conn.Execute "INSERT INTO phone_1(phone_number, name_id) values('value_1','value_2')" End Sub --------------- Now for some strange reason this code only works in the original vb file that I made. When I try make another one, it gives me a compile error. It makes me wonder how I got it to work in the first place. This code is useless unless I can put it in other vb scripts.. Also, it freaks me out..because I can't even reproduce the same document and get it to work without a compile error. I follow the same original steps... Create new vb script.exe, insert command button, double click on the command button, paste the code... and voila.. IT DOES NOT WORK?!?! Why does my original work and the reproductions give me compile errors? please help, thanks in advance... |
|
#2
|
||||
|
||||
|
Right off hand I would say to make sure that you have a reference to the ado library set up in your project.
Also, please post visual basic related questions in the visual basic forum. This forum is for C languages. |
|
#3
|
|||
|
|||
|
I didn't realize that it was in the wrong area.
on the upside, you were right about the refrence... thank you |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > vb6 problem (newbie question) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|