Problem use VB6.0 connect via ODBC to MySQL
--0-1052125843-1106795771=:56790
Content-Type: text/plain; charset=us-ascii
Hi,
I have problem with use VB6.0 connect to MySQL4.1.9(win32);i have question this
1.How i can define connectionstring? I try to connect via DSN which i create form System DSN by use My ODBC 3.51 another i try connect via provider but Error Msgbox alert me too?
2.Parameter uid(Userid) and pwd(password), I need to define value? Like uid=sa and pwd=pwd, need?
3.In step “ rs.Open .....”, What i wrong?? It ‘s appear “Run-Time Error ‘3709’: Operation is not allowed on object referencing a closed or invalid connection”
4.Please,Explain me about “cn, adOpenKeyset, adLockOptimistic, adCmdText “ and How to use it?
Thanks your
Team
Option Explicit
Private cn As ADODB.Connection
Private rs As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.Open "DSN=dsn4mysql;uid=;pwd=;database=DB1" ‘dsn4mysql i create form System DSN with install MyODBC 3.51 too.
‘Another way i can use like this or not? cn.ConnectionString = "driver={MySQL};" & _
"server=127.0.0.1;uid=;pwd=;database=DB1"
Set rs = New ADODB.Recordset
rs.Open "select name,mo from Table1", cn, adOpenKeyset, adLockOptimistic, adCmdText
end sub
---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
--0-1052125843-1106795771=:56790--
RE: Problem use VB6.0 connect via ODBC to MySQL
Hi,
Try this one:
Sub test()
Dim con As New ADODB.Connection, rs As ADODB.Recordset
con.Open "DRIVER=3D{MySQL ODBC 3.51 Driver};DESC=3D;DB=3Ddbname;SER=
VER=3Dserver_ip;UID=3Dusername;PASSWORD=3Dpassword;PORT=3D33 06;SOCKET=3D;=
OPTION=3D;STMT=3D;"
Set rs =3D con.Execute("SELECT now()")
Debug.Print "Time: "; rs.Fields(0).Value
rs.Close
con.Close
Set rs =3D Nothing
End Sub
Also you can read about adOpenKeyset, adLockOptimistic, and adCmdText on =
Microsoft web site (MSDN online).
> -----Original Message-----
> From: SalaPao Soil [mailto:safesoil [at] yahoo.com]
> Sent: Wednesday, January 26, 2005 10:16 PM
> To: myodbc [at] lists.mysql.com
> Subject: Problem use VB6.0 connect via ODBC to MySQL
>
>
>
> Hi,
>
> I have problem with use VB6.0 connect to
> MySQL4.1.9(win32);i have question this
>
> 1.How i can define connectionstring? I try to
> connect via DSN which i create form System DSN by use My ODBC
> 3.51 another i try connect via provider but Error Msgbox
> alert me too?
>
> 2.Parameter uid(Userid) and pwd(password), I
> need to define value? Like uid=3Dsa and pwd=3Dpwd, need?
>
> 3.In step " rs.Open .....", What i wrong?? It
> 's appear "Run-Time Error '3709': Operation is not allowed on
> object referencing a closed or invalid connection"
>
> 4.Please,Explain me about "cn, adOpenKeyset,
> adLockOptimistic, adCmdText " and How to use it?
>
> Thanks your
>
> Team
>
>
>
> Option Explicit
>
> Private cn As ADODB.Connection
>
> Private rs As ADODB.Recordset
>
> Private Sub Form_Load()
>
> Set cn =3D New ADODB.Connection
>
> cn.Open "DSN=3Ddsn4mysql;uid=3D;pwd=3D;database=3DDB1" 'dsn4mysql
> i create form System DSN with install MyODBC 3.51 too.
>
> 'Another way i can use like this or not?
> cn.ConnectionString =3D "driver=3D{MySQL};" & _
>
> "server=3D127.0.0.1;uid=3D;pwd=3D;database=3DDB1"
>
> Set rs =3D New ADODB.Recordset
>
> rs.Open "select name,mo from Table1", cn, adOpenKeyset,
> adLockOptimistic, adCmdText
>
> end sub
>
>
>
>
> =09
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Search presents - Jib Jab's 'Second Term'
>
=A0
Attention:
Any views expressed in this message are those of the individual sender, e=
xcept where the message states otherwise and the sender is authorized to =
state them to be the views of any such entity. The information contained =
in this message and or attachments is intended only for the person or ent=
ity to which it is addressed and may contain confidential and/or privileg=
ed material. If you received this in error, please contact the sender an=
d delete the material from any system and destroy any copies.
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc [at] m.gmane.o rg