borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (linking 3 tables) New Topic New Poll Post Reply
AndreaVB Forum : Database : Connecting to mySQL
Poster Message
wen_dell
Level: Scholar

Registered: 17-01-2005
Posts: 46

icon Connecting to mySQL

is there somebody who knows how to connect to mySQL database using VB and ADO code. thanks in advanced  

____________________________
GOD IS MY SHEPERD

24-04-2007 at 06:12 AM
View Profile Send Email to User Show All Posts | Quote Reply
Jihadalariqi
Level: Protégé

Registered: 18-12-2007
Posts: 4
icon Re: Connecting to mySQL

you can use code like this




Dim Cn As ADODB.Connection  
Dim Rs As ADODB.Recordset  
Private Sub cmdConnect_Click()  
Set Cn = New ADODB.Connection  
Cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _  
            & "SERVER=" & txtHost.Text & ";" _  
            & "DATABASE=" & txtDB.Text & ";" _  
            & "UID=" & txtUser.Text & ";" _  
            & "PWD=" & txtPass.Text & ";" _  
            & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384  
Cn.CursorLocation = adUseClient  
Cn.Open  
MsgBox "Connected"  
End Sub





and  this  link  for  connectionstring with any DB

http://www.connectionstrings.com/



____________________________
vbboy

18-12-2007 at 10:54 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : Connecting to mySQL
Next Topic (linking 3 tables) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder