Ingres and Visual Basic

Associate
Joined
18 Oct 2002
Posts
2,154
Location
Leicester, UK
Hi,

I am trying to execute some Ingres commands through Visual Basic using Shell but it is not having any of it. If I create a batch and use the following command: sql MyDatabase < MyFile.in this works fine.

If I do the same in Visual Basic I get an error but I am not sure what it is as the DOS box comes up and goes in a split second.

Does anyone have any suggestions?

Many Thanks,

TrUz
 
Hi JIMA,

That is what I am currently doing at the moment - getting VB to write the batch file, execute it then delete the batch file. The application will be running under the admin account so user permissions is not a problem here.

I will have a go at trying to capture the error so you can take a look.

Thanks for your help.

EDIT: Ok here is the error I am getting.
Code:
xxx     ::[II\NMSVR\3c8    , 00000000]: Wed Jul 19 08:18:26 2006 E_GC0130_GCN_BAD_SYNTAX	User supplied database name is not formatted properly. Format for database name is: vnode::dbname/class. Vnode:: and /class are optional.
xxx     ::[II\NMSVR\3c8    , 00000002]: Wed Jul 19 08:18:26 2006 E_CLFE07_BS_READ_ERR	Read from peer process failed; it may have exited.
Seems it is telling me the Database name is not formatted properly. But I am using 'sql mydb < myscript.sql' - Cannot see why it will not work.

TrUz
 
Last edited:
Getting it working from a Batch file is not a problem that is fine. What I am trying to do is this:

Code:
Dim RetVal as Double
RetVal = Shell("sql mydb < C:\myscript.sql", vbNormalFocus)
This is when it dies for no apparent reason.

EDIT: If I do just:
Code:
Dim RetVal as Double
RetVal = Shell("sql mydb", vbNormalFocus)
It opens up a session ready for me to enter commands?

This is getting annoying now.

TrUz
 
Last edited:
JIMA said:
OK, try using the cmd.exe command to run your sql, providing the /c switch and then the command to run.

Shell "cmd.exe /c sql mynode::mydb<c:\myscript.sql",vbHide"

It sure is annoying, particularly as it's so difficult to trap errors so you can get some clue as to what's happening.

Try that and let me know what happens.
Dude, that **** works!!! :D

It did not even cross my mind to try that.

Many thanks for you help.

A very happy TrUz. :)
 
Back
Top Bottom