Move SQL Server DB Out Of SQL Server And Into The App_Data Directory As An .mdf File?
Apr 13, 2010
I'm currently writing a website in ASP.NET MVC, and my database (which doesn't have any data in it yet, it only has the correct tables) uses SQL Server 2008, which I have installed on my development machine. I connect to the database out of my application by using the Server Explorer, followed by LINQ to SQL mapping.
Once I finish developing the site, I will move it over to my hosting service, which is a virtual hosting plan. I'm concerned about whether using the SQL Server setup that is currently working on my development machine will be hard to do on the production server, as I'll have to import all the database tables through the hosting control panel. I've noticed that it is possible to create a SQL Server database from inside Visual Studio. It is then stored in the App_Data directory.
Does it make sense to move my SQL Server DB out of SQL Server and into the App_Data directory as an .mdf file? If so, how can I move it? I believe this is called the Detach command, is it not? Are there any performance/security issues that can occur with a .mdf file like this? Would my intended setup work OK with a typical virtual hosting plan? I'm hoping that the .mdf database won't count against the limited number of SQL Server databases that can be created with my plan.
I have 5 GB data, when I move from SQL server 2000 to 2008 with Import and Export wizard, my LDF size is increased to 30 GB, Can I reduce my LDF file or move. In my one of the table contain around 20 Lakh data which i have normalized in 2008 and create 4 tables, so my data is entering in normalized form in 2008. But due to size by hard disk is full. I have used shrnik command but it reduce to only 1 GB.
I'm using VS 2008 web developer express and SQL Server 2008 express. I created a few dbs using management studio and then created an App_Data Folder in the Web Developer. However, I cannot add the DBs that i created to the App_data folder. I navigated to C:Program FilesMicrosoft SQL ServerMSSQL10.SQLEXPRESSMSSQLDATA and tried to add the DB to the App_data folder. I get the following error:
"The File cannot be added because its being used by another process.
c:1 and in it there is a file called "file.dat" now how can i call a move routine lets say on a button click and from the c: directory move "file.(1).dat" into c:1, if file.dat already exists in that directory .
so if i do a move aain from the root directory c: it wil put "file(2).dat" and so on ..
Our project is based on asp.net 1.1 framework using Asp.net / vb.net as code behind, is it possible to rename a file in a folder and move it to another folder on server or will there be any permissions problem.
This is a webapplication hosted on a dedicated server, this server is managed by us.
I will have file one machine in excel format.And i have the website and database hosted on go daddy.I need to move data from that file to sql server database table.The machine will have internet on it all the time. Is there a way i can accomplish this?
I have a couple of database built in web developer 2008 expression. The database file is placed in App_Data folder. in this case I have SQL server Express Edition installed on my computer. so I can veiw database using dataconnection.
However, I will deploy my website and using SQL server. In this case, how can I transfer my database in the App_Data to SQL server database?
I have a web server with a web application and a website both on it (2 seperate entities within IIS7.0). The web application needs to be able to upload files to a virtual directory created within the same web server and the website needs to be able to view that virtual directory to be able to allow for downloading of those files.
This sounds really easy, but I cannot figure out how to do the upload and the download.
Virtual directory = own folder file structure (does not fall within either website/webapp structure)
Website - standard user for outside users.
Webapp - authentication requierd and only used by inside users.
Webapp users upload files to virtual directory Website users download files from virtual directory (i.e. open files)
A variety of files (pdf, images, etc.) are stored in a ntext field on a MS SQL Server. I am not sure what type is in this field, other than it shows question marks and undefined characters, I am assuming they are binary type.
The script is supposed to iterate through the rows and extract and save these files to a temp directory. "filename" and "contenttype" are given, and "data" is whatever is in the ntext field.
This works, but the file should be saving to the server instead of popping up save-as dialog. I am not sure if there is a way to save the response to file.
I have an ASP.Net (2.0) application on an intranet that impersonates the users Windows login.
It has <identity impersonate="true" /> in the web.config file.
In a couple of places it needs to create a file in the temp folder of the server (a text file in one instance and a Word doc in another instance) before sending the resulting file to the user, after which it is deleted.
It runs into a permission problem, which I assume is because the user that is being impersonated does not have permission to write to the server's hard drive.
How do I overcome this?
I assume it be something along the lines of temporarily running under a different account for the create/read/write/delete temp file parts of code.
how to do this and which account would be the best (easiest) to use. It will be a Windows 2003 server.
i tried to add sql/server database file to app_data and i got this error
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)
im using sqlserver 2005 and VS2008 +i tried to amke remote cpnnection and restart the services but with no use
I am currently developing a website currently in ASP.NET. I need to give the current ready website to another collaborator to continue with the work. But how do I send the database along with the website?
If this is done, what steps do I need to follow to use the database on the new machine? Do I need to change web.config or what more?
I've developed a site that uses a simple database with only one table.I designed th db in sql server 2005, and I use VS2008 as the IDE for site devlpmnt(VB.NET).The problem is that when I try to add the db file int the App_Data folder of my site by right clkg it and selecting 'Add Existing Item',it shows a message like this: "Connections to SQL Server files(*.mdf) requires SQL Server Express 2005 to function properly.Please verify the installation of the component or download from the [URL]
I have an ASP.Net MVC app, and i have some xsl files inside of the Content directory.I've try a few methods to get directory dynamically buy keep on coming short.So how do i get the directory to point to the Content/xsl folder?the closest that i came to was with this:this.GetType().Assembly.CodeBase
which only returns the project DLL, but i can't figure out how to move up a few levels from there or what .net library to use to navigate around the path.there's no ../.. :(Basically i want to navigate to the Content/xsl folder which is at the same level of the Bin directory.
I am just learning application development and my question is so I can demo a project from an Internship for a class at school. I am planning on using Visual Studio 2010 in debug mode for the presentation.
Here it goes:
I created a database utilizing SQL server 2005. I want to take the .mdf file from SQL Server and place it in the App data directory of my application. I am hoping that I do not need to rebuild any datasets that I am currently utilizing. I am utilizing several stored procedures that are in the database, these stored procedure are access utilizing my datasets.
I was able to place the file in the application but I get an exception whenever I try to utilize a stored procedure that was created in the database.
Here is the error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I verified all of my datasets utilize the following connection:
I am confused as to what to do with these. I have .cs files in App_Code. I also have other files in App_Data, and Bin. Could I just create these folders, make them virtual directories and upload my files as normal? Or do I need to do something special with these folders/files? Im really stuck on this. Also, this is a "shared hosting" account.
I'm new to .NET and while starting to learn ASP .NET MVC2 framework I see that you can create a .mdf file inside the App_Data folder and connect to it or you can connect to a SQL Server.What is the difference between these to methods of interacting with a database? What are the advantages/disadvantages of one over the other?
I have a shared hosting account where I can host multiple domains. I connected to the web from Visual Studio and there is a wwwroot directory [URL] I have to put the website under this folder. When you create a website under VS, it just puts the files in [URL], can I create a folder and default to wwwroot or can I manually move the webconfig and App_Data?
I have an user control that reads the data from app_data folder and does some processing.In design time I'd like to show the row data in control placeholder (using GetDesignTimeHtml).To do that I need to figure out the absolute path to app_data folder on my project.The HttpContext is not available and HostingEnvironment.MapPath returns null.
, I've researched this quite a bit and I'm just not seeing the problem. The app runs beautifully when living on my pc - the app on my pc connects successfully to the SQL Server 2008 Express Database (which sits on a server - not my pc). However, as soon as I publish this application to the server that the SQL Server 2008 Express Database sits on, I get this error when I try to run the application:
ERROR [42S02][Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'user'
It's behaving as if it either doesn't know where the table is when the app tries to run on the same server as the database or maybe the app doesn't have permission to hit the database once the app is on the same server as the database. I have connections on my pc and the server defined for this database, I verified that I set up each connection the same. I've also tried connecting using [dbo].[user] and this doesn't remedy the situation either. my connection string is in my web.config and it looks like this: