I downloaded the code and I read the readme.txt file which says
"SQL Server 2005 - Non-Express Edition Setup
You can use the same .mdf and .ldf files that were distributed with the code download,
but you need to attach them to your SQL Server 2005 database. You also need credentials
to allow you to use the new database.
1) Copy the .mdf and .ldf files to a folder on the SQL Server computer, and name them
with a name you like. This is how I named mine:
However, I don't find the .mdf and .ldf files. All I found in the App_Data folder is ASPNETDB.mdf, aspnetdb_log.ldf, CreateAllObjects.sql, DeleteAllData.sql, DisableConstraints.sql, EnableConstraints.sql. Should I run some of these sql scripts to create
the database? I'm using sql server 2005 standard edition. Any help is greatly appreciated. Thanks
In the book that accompanies the starter kit (Chapter 12 Deployment) the author writes about importing data to remote SQL server. The Author instructs you to disabling constraints on the local database first. The EnableConstraints.sql and DisableConstraints.sql
refer to this.
am I supposed to create first the database "TheBeerHouse" and then run the script against it that creates the tables and the stored procedures? I also noticed that the web.config file doesn't reference the database "TheBeerHouse". It has the following connection
strings section:
Ok thank you. Also in the readme.txt there is the following instruction:
4) Replace the query in your query window with this code and press F5 to run it - please
make changes to the user credentials first - NEVER use the same username and password
as those that come from a book or Internet site:
USE TheBeerHouse
GO
EXEC sp_addlogin 'DBuserName', 'SecretPassword', 'TheBeerHouse'
GO
EXEC sp_grantdbaccess 'DBuserName', 'DBuserName'
GO
EXEC sp_addrolemember 'db_datareader', 'DBuserName'
GO
EXEC sp_addrolemember 'db_datawriter', 'DBuserName'
GO
EXEC sp_addrolemember 'db_owner', 'DBuserName'
GO
am I supposed to run this query on the database aspnetdb? Thanks
Annddrew
Member
237 Points
85 Posts
How to set up the database?
Mar 16, 2008 03:23 PM|LINK
I downloaded the code and I read the readme.txt file which says
"SQL Server 2005 - Non-Express Edition Setup
You can use the same .mdf and .ldf files that were distributed with the code download,
but you need to attach them to your SQL Server 2005 database. You also need credentials
to allow you to use the new database.
1) Copy the .mdf and .ldf files to a folder on the SQL Server computer, and name them
with a name you like. This is how I named mine:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TheBeerHouse.mdf
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TheBeerHouse_Log.ldf"
However, I don't find the .mdf and .ldf files. All I found in the App_Data folder is ASPNETDB.mdf, aspnetdb_log.ldf, CreateAllObjects.sql, DeleteAllData.sql, DisableConstraints.sql, EnableConstraints.sql. Should I run some of these sql scripts to create the database? I'm using sql server 2005 standard edition. Any help is greatly appreciated. Thanks
scott@elband...
Star
11346 Points
1865 Posts
Re: How to set up the database?
Mar 16, 2008 03:39 PM|LINK
Run CreateAllObjects.sql to set up the database.
Annddrew
Member
237 Points
85 Posts
Re: How to set up the database?
Mar 16, 2008 04:05 PM|LINK
Thank you for your reply. What about the other scripts such as EnableConstraints.sql ?
scott@elband...
Star
11346 Points
1865 Posts
Re: How to set up the database?
Mar 16, 2008 04:47 PM|LINK
In the book that accompanies the starter kit (Chapter 12 Deployment) the author writes about importing data to remote SQL server. The Author instructs you to disabling constraints on the local database first. The EnableConstraints.sql and DisableConstraints.sql refer to this.
Annddrew
Member
237 Points
85 Posts
Re: How to set up the database?
Mar 18, 2008 02:34 PM|LINK
am I supposed to create first the database "TheBeerHouse" and then run the script against it that creates the tables and the stored procedures? I also noticed that the web.config file doesn't reference the database "TheBeerHouse". It has the following connection strings section:
<connectionStrings><
remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" providerName="System.Data.SqlClient"/><!--<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" providerName="System.Data.SqlClient"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQL05;Initial Catalog=TheBeerHouse_Remote;User ID=sa;Password=ok" providerName="System.Data.SqlClient"/>
--></
connectionStrings>Only the aspnetdb database is referenced here. What about the database "TheBeerHouse" ? Thanks
scott@elband...
Star
11346 Points
1865 Posts
Re: How to set up the database?
Mar 18, 2008 02:52 PM|LINK
You need to execute the SQL Script on that database, this will generate all the tables in the aspnetdb like so:

scott@elband...
Star
11346 Points
1865 Posts
Re: How to set up the database?
Mar 18, 2008 02:55 PM|LINK
Have you got the book that accompanies the Beer House Starter Kit? http://www.amazon.co.uk/ASP-NET-2-0-Website-Programming-Programmer/dp/0764584642/ref=pd_bbs_sr_5?ie=UTF8&s=books&qid=1205852029&sr=8-5. It goes into detail about the architecture used I can highly recommend it
Annddrew
Member
237 Points
85 Posts
Re: How to set up the database?
Mar 18, 2008 03:29 PM|LINK
Ok thank you. Also in the readme.txt there is the following instruction:
4) Replace the query in your query window with this code and press F5 to run it - please
make changes to the user credentials first - NEVER use the same username and password
as those that come from a book or Internet site:
USE TheBeerHouse
GO
EXEC sp_addlogin 'DBuserName', 'SecretPassword', 'TheBeerHouse'
GO
EXEC sp_grantdbaccess 'DBuserName', 'DBuserName'
GO
EXEC sp_addrolemember 'db_datareader', 'DBuserName'
GO
EXEC sp_addrolemember 'db_datawriter', 'DBuserName'
GO
EXEC sp_addrolemember 'db_owner', 'DBuserName'
GO
am I supposed to run this query on the database aspnetdb? Thanks
scott@elband...
Star
11346 Points
1865 Posts
Re: How to set up the database?
Mar 18, 2008 03:41 PM|LINK
Only if you want to add a new login (if so you will need to update the connection string), you could just leave it as it is and it should work ok.
Annddrew
Member
237 Points
85 Posts
Re: How to set up the database?
Mar 18, 2008 03:46 PM|LINK
Ok Thank you very much. Yes I have the book and I have just started reading it so I will probably have many questions to ask.