Archive: Installer crashing....


Installer crashing....
I have a script that attaches a DB and it works! I have another one that checks to see if a DB exists first and then if it does not, it attaches (sp_attach_db) a Db.

Here the SQL query :VerifyIfDBExists.sql




if NOT db_id('someDB') IS NULL
begin
Select 'TRUE'
end
else
begin
Select 'FALSE'
end



Here is the part that crashes in NSIS:


file "C:\Documents and Settings\....\VerifyIfDBExists.sql"

MSSQL_OLEDB::SQL_ExecuteScript /NOUNLOAD "VerifyIfDBExists.sql"
Pop $0
Pop $0
DetailPrint $0
MSSQL_OLEDB::SQL_GetError /NOUNLOAD
Pop $0
Pop $0
DetailPrint $0

MSSQL_OLEDB::SQL_GetRow
Pop $0
Pop $DbExists
DetailPrint $DbExists
sleep 6000

MSSQL_OLEDB::SQL_GetError /NOUNLOAD
Pop $0
Pop $0
DetailPrint $0

${EndIf}

${If} $DbExists == 'FALSE'

RMDir /r "$INSTDIR\SQL"


SetOutPath "$INSTDIR\Data"

file "C:\......someDb.mdf"
file "C:\......someDb.ldf"


AccessControl::GrantOnFile "$INSTDIR\Data" "(BU)" "FullAccess"



MSSQL_OLEDB::SQL_Execute /NOUNLOAD "sp_attach_db [someDb],[$INSTDIR\Data\someDb.mdf],[$INSTDIR\Data\someDb.ldf]"
; Pop $0
; Pop $0
; DetailPrint $0
Sleep 6000

MSSQL_OLEDB::SQL_GetError /NOUNLOAD
;Pop $0
;Pop $0
;DetailPrint $0

MSSQL_OLEDB::SQL_Logout

MSSQL_OLEDB::SQL_GetError /NOUNLOAD

${Else}

DetailPrint "Hey it's there"
sleep 4000
${EndIf}



If i remove: MSSQL_OLEDB::SQL_Execute /NOUNLOAD "sp_attach_db ...
it will not Crash!


Anybody has an idea?


P.S. THe script crashes if i call the the VerifyIfDbExists script..it does not seem to like an SQL script returning a variable.. Ithink i'll try logging out and logging back in between the return of the Variable and the attach script

If i take out the verification (VerifyIfDBExists.sql), it does not crash but it does not attach a DB neither.
Sounds like some sort of authorization missing for windows...Because when i try to use the installer where it is created it says that windows cannot acces the folder, i have to move it on my desktop to launch it!

Any ideas?


If i execute a script it does not crash at all!! Really weird...