Last post Mar 18, 2008 03:57 PM by firstname.lastname@example.org
Mar 16, 2008 03:23 PM|Annddrew|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
Mar 16, 2008 03:39 PMemail@example.com|LINK
Run CreateAllObjects.sql to set up the database.
Mar 16, 2008 04:05 PM|Annddrew|LINK
Thank you for your reply. What about the other scripts such as EnableConstraints.sql ?
Mar 16, 2008 04:47 PMfirstname.lastname@example.org|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.
Mar 18, 2008 02:34 PM|Annddrew|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
<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"/>
Only the aspnetdb database is referenced here. What about the database "TheBeerHouse" ? Thanks
Mar 18, 2008 02:52 PMemail@example.com|LINK
You need to execute the SQL Script on that database, this will generate all the tables in the aspnetdb like so:
Mar 18, 2008 02:55 PMfirstname.lastname@example.org|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
Mar 18, 2008 03:29 PM|Annddrew|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:
EXEC sp_addlogin 'DBuserName', 'SecretPassword', 'TheBeerHouse'
EXEC sp_grantdbaccess 'DBuserName', 'DBuserName'
EXEC sp_addrolemember 'db_datareader', 'DBuserName'
EXEC sp_addrolemember 'db_datawriter', 'DBuserName'
EXEC sp_addrolemember 'db_owner', 'DBuserName'
am I supposed to run this query on the database aspnetdb? Thanks
Mar 18, 2008 03:41 PMemail@example.com|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.
Mar 18, 2008 03:46 PM|Annddrew|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.
Mar 18, 2008 03:57 PMfirstname.lastname@example.org|LINK
Hee, hee yes I had a lot of questions when I read the book! Theres another forum on the Wrox website as well that maybe worth checking out