C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 16th, 2003, 10:58 PM
sparkrulez sparkrulez is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Canada
Posts: 19 sparkrulez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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...

Reply With Quote
  #2  
Old January 17th, 2003, 12:32 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
  #3  
Old January 17th, 2003, 12:38 PM
sparkrulez sparkrulez is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Canada
Posts: 19 sparkrulez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking sorry

I didn't realize that it was in the wrong area.

on the upside, you were right about the refrence...

thank you

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > vb6 problem (newbie question)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway