Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server VS2010
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 29-Oct-12 3:33am
Edited 29-Oct-12 4:07am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Z@db@khsh at 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 at 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 at 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 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100