Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute batch file "Read myFile.sql"

Status
Not open for further replies.

jcsilva

Programmer
Aug 17, 2002
6
MX
Hi there,

I'm developing an application in VB 6 and Sybase Adaptive Server Anywhere Database Engine Version 6.0.3.2747.

I'm trying to execute a batch file(.sql) from VB. This file have some sentences. I have been reciving an error:

[Sybase][ODBC Driver][Adaptive Server Anywhere]Syntax error or access violation: near 'Read' in [Read] C:\Temp\bd00.sql

The weirdest thing is that if I execute this command ("Read C:\Temp\bd00.sql") from dbisql, it work excellently!!

My VB code is it:

Set connSybase = New ADODB.Connection
connSybase.ConnectionString = "driver=Adaptive Server Anywhere 6.0;uid=user;pwd=pws;dbf=c:\datos\myDB.db"
connSybase.Open

connSybase.Execute "Read C:\Temp\bd00.sql"

When last line code is executed, I recive this error:
[Sybase][ODBC Driver][Adaptive Server Anywhere]Syntax error or access violation: near 'Read' in [Read] C:\Temp\bd00.sql

Any idea?

Regards,
JCarlos Silva
jc_silvam@hotmail.com
 
Hi JCarlos,

I'm also programming with Sybase and VB6. I think you'd better writing stored procs in your .sql files and execute them in VB6 via a ADO.Query object rather than trying to execute a .sql file directly.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top