i am trying to execute 2 scripts using inno setup. The problem i think is the path of the file that contains spaces. The scripts are working because i already tried the hardcoded path with no spaces and it does work. there is this post where this problem is discribed and a solution is added but i have tried and it doesnt work. this is the topic Inno Setup, spaces and double quote in [Run]
in order not to use hardcoded paths i am using inno setup constants, so on the output folder i have a setup.exe and and folder called testfolder with the 2 scripts, one is for creating a database, and the other is to create the tables. in inno setup did this
connExe:=ExpandConstant('{tmp}')+'\sqlcmd.exe';
pathFx1:=ExpandConstant('{src}')+'\testfolder\teste.sql';
pathFx2:=ExpandConstant('{src}')+'\testfolder\idontimedb.des';
Exec(connExe,' -S DEV3\IDONICSYS4 -U sa -P idsysadmin -i \""'+connFx1+'\""', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
MsgBox(IntToStr(ResultCode), mbError, mb_Ok);
Exec(connExe,' -S DEV3\IDONICSYS4 -d MSSQLTIPS -U sa -P idsysadmin -i \""'+connFx2+'\""', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
MsgBox(IntToStr(ResultCode), mbError, mb_Ok);
when i run both messages boxs show code 2,but i am still unable to find what does this code means. I think my problem is with the backslash and the quotation marks position , but i have already tried different combination and it doesnt work.. Thanks for the help.
the full path of the files are: C:\Users\hsilva\Documents\Inno setupo scripts\Setup\Output\testfolder\teste.sql \create database
C:\Users\hsilva\Documents\Inno setupo scripts\Setup\Output\testfolder\idontimedb.des \create tables
C:\Users\hsilva\Documents\Inno setupo scripts\Setup\Output\setup.exe \executable
thanks in advance...
UPDATE - 27/10/2014 so as user LTama sugested(thanks once again TLama) i have checked the files that were needed for running the scripts.. and the files needed were commented,i made a few changes and now it is giving me code 1.What does it mean? i use the code found in this site http://0x3f.org/blog/howto-execute-sql-scripts-in-inno-setup/ and made a few changes.
in the files section i have got this:
Source: "C:\Users\hsilva\Documents\InnoSetup\sqlcmd.exe"; Flags: dontcopy ;
Source: "C:\Users\hsilva\Documents\InnoSetup\sqlcmd.rll"; Flags: dontcopy ;
Do i need to have these 2 files, because when installing sql server 2008 r2, these files are installed , and available?
in the code section i have got this:
procedure DeinitializeSetup();
var
connExe:String;
connFx1:String;
begin
ExtractTemporaryFile('sqlcmd.exe');
ExtractTemporaryFile('sqlcmd.rll');
connExe:=ExpandConstant('{tmp}')+'\sqlcmd.exe';
connFx1:=ExpandConstant('{src}')+'\folder\teste.sql';
Exec(connExe,' -S DEV3\IDONICSYS4 -U sa -P idsysadmin -i \""'+connFx1+'\""', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
MsgBox(IntToStr(ResultCode), mbError, mb_Ok);
end;
end;
this is execute in the end of setup, i ommited some of the checks like checking if the instance exists..