Home All Groups Group Topic Archive Search About

VB6 MYSQL - > Trying to load ascript file from VB6 -

Author
23 Mar 2006 9:00 PM
Jay Cee
Hi all,
I have MySql 4.1 with VB6.
I need to run a batch file via VB6 code which contains a bunch
of create table statements & inserts of data.
To do this from the command line of MySql I do,
SOURCE c:/myscript.txt;  
This works perfectly , but not through VB6.

This is what I got so far,

'Set up connection to MySql (works)
Call connectMysql("root", "", gblIpAddress, "test", conn, rs)

'Create the Sql statement    (works)
ssql = "CREATE DATABASE IF NOT EXISTS mytest;"

'Execute the sql statement    (works)
conn.Execute (ssql)

'load the batch file to populate the database    (Errors out here)
ssql = "SOURCE c:/myscript.txt;"
conn.Execute (ssql)

I have tried                                                     (Same Error here)
ssql = "LOAD DATA INFILE c:/myscript.txt;"
conn.Execute (ssql)

Please help....
If this is not the correct forum , please let me know,
Thank you in advance,
Jay

Author
26 Mar 2006 10:59 PM
Leisa
Have you tried something like the following? I know the following is what I
do for Oracle - not sure if it's similar to My Sql....

ssql = "@c:\myscript.txt;"
conn.execute (ssql)

Leisa


Show quoteHide quote
"Jay Cee" wrote:

> Hi all,
> I have MySql 4.1 with VB6.
> I need to run a batch file via VB6 code which contains a bunch
> of create table statements & inserts of data.
> To do this from the command line of MySql I do,
> SOURCE c:/myscript.txt;  
> This works perfectly , but not through VB6.
>
> This is what I got so far,
>
> 'Set up connection to MySql (works)
> Call connectMysql("root", "", gblIpAddress, "test", conn, rs)
>
> 'Create the Sql statement    (works)
> ssql = "CREATE DATABASE IF NOT EXISTS mytest;"
>
> 'Execute the sql statement    (works)
> conn.Execute (ssql)
>
> 'load the batch file to populate the database    (Errors out here)
> ssql = "SOURCE c:/myscript.txt;"
> conn.Execute (ssql)
>
> I have tried                                                     (Same Error here)
> ssql = "LOAD DATA INFILE c:/myscript.txt;"
> conn.Execute (ssql)
>
> Please help....
> If this is not the correct forum , please let me know,
> Thank you in advance,
> Jay