Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm working out on creating membership schema in VS by reading this link,
In first step, it propose to create an database file in VS by adding a database file to App_data folder, and next I should open the MS SQL 2005 Express to determining that file.
I have MS SQL server 2008 R2, and when I want to add the database than I create in App_data,
I can't find it...
because The SQL server message : cannot access the specific path or file on the server. verfy that you have the necessary security privileges and the path or file exists.
How I can add that database?
can I create a database in MS SQL server and use it for this article?
if yes, How?
Posted
Updated 29-Oct-12 3:07am
v3

1 solution

If this is for Sql server, then you shouldn't copy the file to you local folder - it should be where the SQL server instance can get hold of it - which may not be on the same machine as your local web site (or even have any access to you local web site machine). You should create the database in SQL server on the instance the web site will be using.

Alternativley, the easier way to do all this is to use an access database and follow this tutorial: Introduction to Membership[^] which take you through the process very quickly.
 
Share this answer
 
Comments
Z@db@khsh 29-Oct-12 9:11am    
I don't want to copy a file in a folder, I create a database file in App_data, named SecurityTutorials.mdf, and when I want to determining this to SQL server 2008, that error prompt...
OriginalGriff 29-Oct-12 9:14am    
You can't necessarily do that.
Most websites are hosted on a different machine from the one containing the SQL server instance - which means that the SQL server probably does not have any access to the hard drive you have put the file on.
Z@db@khsh 30-Oct-12 1:23am    
I agree with you, but for this situation, what can I do?
in this article, can I design a database in SQL and follow the steps?
OriginalGriff 30-Oct-12 4:22am    
Connect to your SQL server instance and construct the database there - you can do it in code (provided your SQL login has sufficient permissions)
If you construct it locally using the same version of SQL server, then have a look here: http://www.codeproject.com/Tips/461494/Backing-up-an-SQL-Database-in-Csharp
You may be able to use similar code to restore it to your production server.
Otherwise, you will have to use SSMS to create a database copy via the SCRIPT command (right click the DB name, and follow the dialogs) - you can then use the script file to recreate the DB on the production server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900