Subject Re: ISQL not executing when launched from Delphi or Wise Install
Author homerjones1941
Okay, my previous post was wrong, but it was even easier. All I had to do was launch isql and wait for it to finish. There wasn't actually a need to change directories. In my previous code sample, WinExec was not what was actually used. It was an ExecAndWait procedure from:
http://www.delphidabbler.com/codesnip?action=named&showsrc=1&routines=ExecAndWait

Sorry for the multiple posts on this topic.


--- In firebird-support@yahoogroups.com, "homerjones1941" <homer@...> wrote:
>
> I knew it had to be simple. I neglected to change to the directory where the script file was located. See the ChDir command in the Delphi code below. Problem solved unless someone has a better way. Thanks.
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> ChDir('C:\ABSFIREBIRD\SQLTEST');
> WinExec('isql -i MyScript.sql',SW_SHOWNORMAL);
> end;
>
>
>
>
> --- In firebird-support@yahoogroups.com, "homerjones1941" <homer@> wrote:
> >
> > After reading The Firebird Book, and searching Google a number of different ways, I figure I'm missing something simple.
> >
> > I used IBExpert to make a "Create Database" DDL script. When I use that script with ISQL from the Windows command line, it creates the expected database file. Because the script didn't work as expected when launched by Delphi or Wise, I created a batch file that also works fine from command line or when double clicked. However, when I launch the batch file (or isql) from Delphi or Wise, the command window just flashes and the script does not run.
> >
> > More Info:
> >
> > The batch file contains only one line:
> > isql -i abs3db.sql
> > In an attempt to see why it wasn't working I changed the command to:
> > isql -e -i abs3db.sql
> > When I ran this batch file from CMD it worked as expected, giving a mile of echoed commands, and created the DB.
> >
> > In Delphi I've used WinExec, ShellExecute, and CreateProcess. In every case the Command Window just flashes but isql doesn't launch and the script doesn't run.
> >
> >
> > OS: Windows XP Pro.
> > Delphi 2007.
> > Wise Install Builder 7.X
> >
> > I suspect my problem is not with ISQL, but with how I am launching it, although its behavior is identical in both Wise and Delphi. I hope someone else has run into this.
> >
>