This wizard will display various screens to get information
from the user to create the tables and stored procedures. In our scenario we
would like to automate this procedure and not display all these screens. In
order to do this, we need to look at the various options of aspnet_regsql.exe
Figure 1
-W
|
Will run in Wizard Mode
|
-C
|
Connection String to the computer running SQL Server where
the database will be installed. You can also specify -S and login parameters
and not use this option.
|
-S
|
The name of the computer running SQL Server where the
database will be installed.
|
-U
|
The SQL Server User ID to login with
|
-P
|
The password to login with
|
-E
|
Authenticates using the Windows credential
|
-d
|
The database to create or modify
|
-A all|m|r|p|c|w
|
What all support needs to be added
Options are
All - All features
M - Membership
R - Role Management
P - Profile
C - Web Parts Personalization
W - Web Events
|
- R all|m|r|p|c|w
|
Removes support for specified feature
|
- Q
|
Runs the tool in Quiet Mode and does not confirm before
removing any feature
|
In order to create our database with all features, you will
use the following command:
Listing 2
aspnet_regsql.exe -S<servername> -E -d<databasename> -A all
In order to call this command we will use the Shell
function. The syntax will be the following code.
Listing 3
Shell("C:\Windows\system32\cmd.exe /C
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regsql.exe -S
""" & txtServer.Text & """ -E -d
""" & txtDatabase.Text & """ -A
all", AppWinStyle.Hide)
The AppWinStyle.Hide will make sure that we do not see the
command window popup and go away.