|
-
Jan 21st, 2007, 08:26 PM
#1
Thread Starter
Fanatic Member
[RESOLVED]Deploy .NET 2003 with Database
is there a way when installer that i made using .NET 2003 is checking for the Database first, if not exists then make it instead install the app that i made?
i have a hard time when deploying it with my friend..i made the database manually..it's not a big problem since i only using 3-5 table with less than 15 SPROC..but what about if i develop more
thanks,
Last edited by erickwidya; Jan 25th, 2007 at 08:21 PM.
-
Jan 24th, 2007, 01:55 PM
#2
Re: Deploy .NET 2003 with Database
I don't understand your question.
Are you asking if your Installer can create an MS Access Database?
-
Jan 24th, 2007, 03:31 PM
#3
Re: Deploy .NET 2003 with Database
Your installation should normally check for each files existence before installing a new one. The installers will check for a previous installagtion not for your database.
You can however do that with Inno Setup but it is not the default method for installers.
-
Jan 24th, 2007, 08:25 PM
#4
Thread Starter
Fanatic Member
Re: Deploy .NET 2003 with Database
thx Hack and randem
Are you asking if your Installer can create an MS Access Database?
simillar but not with Access, i'm using MSSQL 2000.
so first the installer is check at the MSSQL wether or not the Database exist, if exista it will prompt user with option to overwrite or keep the existing Database..if doesn't exists then just make the Database with related Table, SPROC,etc that being used for that application
You can however do that with Inno Setup but it is not the default method for installers.
i plan to do that with Deployment project in .NET 2003 not using 3rd party installer but if that's the only way to do it then it doesn't matter to me..can u give me some link with the latest version of inno
thanks
-
Jan 25th, 2007, 03:31 AM
#5
Re: Deploy .NET 2003 with Database
In Inno Setup you can do it with the code section. In most installers you can write a seperate program then execute that first to see what you need to do.
-
Jan 25th, 2007, 03:39 AM
#6
Thread Starter
Fanatic Member
Re: Deploy .NET 2003 with Database
thx randem
In most installers you can write a seperate program then execute that first to see what you need to do.
i see..if i can make that program then its gonna be fine..
when involving with MSSQL then it's best to used SQLDMO to make the program?? or any other thoughts?
thanks
-
Jan 25th, 2007, 03:57 AM
#7
Re: Deploy .NET 2003 with Database
Not really. If you know where the database is and what the name is all you really need to do connect to it. If you cannot then it does not exist or is a not active.
-
Jan 25th, 2007, 04:52 AM
#8
Thread Starter
Fanatic Member
Re: Deploy .NET 2003 with Database
If you know where the database is and what the name is all you really need to do connect to it. If you cannot then it does not exist or is a not active.
i will try to do it..
sorry to bother again,
i already make the Database, SPROC, Table,etc scripts (used extension .sql) and make it as BatchName.cmd that looks like this when it open it VS.NET IDE
@echo off
REM: Command File Created by Microsoft Visual Database Tools
REM: Date Generated: 22/01/2007
REM: Authentication type: Windows NT
REM: Usage: CommandFilename [Server] [Database]
if '%1' == '' goto usage
if '%2' == '' goto usage
if '%1' == '/?' goto usage
if '%1' == '-?' goto usage
if '%1' == '?' goto usage
if '%1' == '/help' goto usage
osql -S %1 -d %2 -E -b -i "Roles.sql"
if %ERRORLEVEL% NEQ 0 goto errors
... and so on ...
goto finish
REM: How to use screen
:usage
echo.
echo Usage: MyScript Server Database
echo Server: the name of the target SQL Server
echo Database: the name of the target database
echo.
echo Example: MyScript.cmd MainServer MainDatabase
echo.
echo.
goto done
REM: error handler
:errors
echo.
echo WARNING! Error(s) were detected!
echo --------------------------------
echo Please evaluate the situation and, if needed,
echo restart this command file. You may need to
echo supply command parameters when executing
echo this command file.
echo.
pause
goto done
REM: finished execution
:finish
echo.
echo Script execution is complete!
:done
@echo on
is there a way to execute this file instead code it? or like usual any other idea?
thanks again
-
Jan 25th, 2007, 05:01 AM
#9
Re: Deploy .NET 2003 with Database
Of course you can shell to execute the batch file but why.
You could just run the command itself from your code and replace the parameters there.
Code:
osql -S %1 -d %2 -E -b -i "Roles.sql"
-
Jan 25th, 2007, 08:18 PM
#10
Thread Starter
Fanatic Member
Re: Deploy .NET 2003 with Database
run the command?? all i know is running OSQL from the command prompt manually ..
ok, this will be my homework, will post it if i found any solution
thanks again randem
-
Jan 25th, 2007, 09:08 PM
#11
Re: [RESOLVED]Deploy .NET 2003 with Database
Hint: Use the Shell or ShellExecute Command.
Last edited by randem; Jan 25th, 2007 at 09:32 PM.
-
Jan 31st, 2007, 10:42 PM
#12
Thread Starter
Fanatic Member
Re: [RESOLVED]Deploy .NET 2003 with Database
ok..i manage to process the Command File (.cmd) that VS.NET 2003 generate in Database Project
the .cmd when u opened it, it contains this description at above
@echo off
REM: Command File Created by Microsoft Visual Database Tools
REM: Date Generated: 31/01/2007
REM: Authentication type: Windows NT
REM: Usage: CommandFilename [Server] [Database]
...
so from that point my guess is when u want to process it u need to make a parameter just like dir command it can have /w, /a as parameter
and the parameter is save at this line (the line below it)
...
if '%1' == '' goto usage
if '%2' == '' goto usage
...
if u use SQL Authentication method, it will have 4 parameters
then i need to 'make' the .cmd know where to look for the script..so i make 3rd variable and use as the script path
...
if '%1' == '' goto usage
if '%2' == '' goto usage
if '%3' == '' goto usage
...
osql -S %1 -d %2 -E -b -i "%3Tables\Users\Users.sql"
if %ERRORLEVEL% NEQ 0 goto errors
...
so when i execute it i need to pass all three parameter using this line
Code:
ID = Shell("""C:\myProject\Database\Mycommand.cmd"" localhost myDB C:\myProject\Database\", , True, 100000)
 Originally Posted by from MSDN
Shell("""C:\Program Files\MyFile.exe"" -a -q", , True, 100000)
Each pair of adjacent double quotes ("") within the string literal is interpreted as one double quote character in the string. Therefore, the preceding example presents the following string to the Shell function:
C:\Program Files\MyFile.exe" -a -q
PS:
i split each project at separate folder for example
C:\myProject contains the .sln,
C:\myProject\Database contains the Database project
C:\myProject\Database\Tables\ contains the the Table(s) script and also with SPROC script
and so on..
don't use '~', space, '-' as a folder name
Last edited by erickwidya; Jan 31st, 2007 at 11:10 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|