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, 11: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 08:51 PM. Reason: Please use code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-02-10, 08: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 TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-07-10, 08:55 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 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 TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-09-10, 04:14 PM
David Edward David Edward is offline
New Member
 
Join Date: Oct 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Try some codes, It doesn't work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-11-10, 10:57 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Sorry for late replies. I am the most likely person to answer, however it's a voluntary job, and I was in the middle of returning from my vacation. hence the delay.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare 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 03:47 PM
Visual Basic and MySQL? smasterross Visual Basic 1 06-30-05 12:39 PM
More info SLAYER18 Job Offers & Assistance 1 01-17-05 06:06 AM
Closing a MySQL connection surebetdmg PHP 5 08-15-03 09:37 AM


All times are GMT -5. The time now is 08:36 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.