Current location: Hot Scripts Forums » Programming Languages » Visual Basic » MySQL Visual Basic 6 connection

MySQL Visual Basic 6 connection

Reply
  #1 (permalink)  
Old 01-29-10, 10:38 AM
srrupert srrupert is offline
New Member
 
Join Date: Jan 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL Visual Basic 6 connection

I have this code for the MySQL in VB 6

It connects fine and inserts that data on the first run but will not for a second,


Code:
Option Explicit
Dim cnMySql As New rdoConnection
Dim rdoQry As New rdoQuery
Dim rdoRS As rdoResultset
 
Private Sub Form_Load()
cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = "uid=name;pwd=pass;server=server;driver={MySQL ODBC 3.51 Driver};database=DATA;dsn=;"
End Sub
 
 
Private Sub Timer1_Timer()
If B(1) = Base(1) Then
B(1) = 0
Text4(1).Text = Text4(1).Text + 1
cnMySql.EstablishConnection
With rdoQry
.Name = "root"
.SQL = "Insert into user (admin,tester,user2,user3,user4) VALUES ('101','202','303','404','505')"
Set .ActiveConnection = cnMySql
Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
End With
rdoRS.Close
cnMySql.Close
 
End If
end sub
I want the data to keep entering "Repeating"
Error I get is the .Name
Object is invalid or not set (It is not set in code)

Last edited by digioz; 02-07-10 at 07:51 PM. Reason: Please use code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-02-10, 07:40 AM
srrupert srrupert is offline
New Member
 
Join Date: Jan 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Does anyone look at these forums?

I had to write the code per Sub to get it to work. I do not like doing it this way and should be a better way.

I removed the Option Explicit and made a MySQL Module with read and write functions and it works fine now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-07-10, 07:55 PM
digioz's Avatar
digioz digioz is offline
Community Leader
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 1,987
Thanks: 2
Thanked 3 Times in 3 Posts
Try putting the "Dim rdoQry As New rdoQuery" inside your timer sub.

Pete
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
want to learn Visual Basic bubazoo Visual Basic 6 10-14-06 02:47 PM
Visual Basic and MySQL? smasterross Visual Basic 1 06-30-05 11:39 AM
More info SLAYER18 Job Offers & Assistance 1 01-17-05 05:06 AM
Closing a MySQL connection surebetdmg PHP 5 08-15-03 08:37 AM


All times are GMT -5. The time now is 10:31 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.