Publishing a SQLExpress Database from Visual Studio - asp.net

I have tables in a local database I've built in Visual Studio 2008 that I want to publish to an existing database on the server that I will be deploying my Asp.NET app. Unfortunately the only two options I have for deploying this database when I select "publish" is -script to file- and -publish to shared hosting provider-. My dedicated DB server is neither.
Can someone help point me in the right direction?

Put your database in the App_Data folder (this is a common approach with SQL Express) and then when you publish there should be an option for including files in the App_Data folder. Once your site goes live, you would definitely NOT want to select this option :)
Also, here is a Microsoft article about using SQL Express with ASP.NET: http://msdn.microsoft.com/en-us/library/ms247257.aspx

Related

deploying asp.net site on IIS

Okay. Here's my problem.
I have this source code of VB.net + asp.net application which was developed on another computer. It comes with,
database - Microsoft sql .mdf + ita log file
source code of the web application
Now what I want to know is,
Do I need to install Microsoft SQL server to deploy this on IIS?
(I do have Microsoft SQL server management studio express installed on my PC but the thing is I can't connect to database engine of it after installing WAMP.)
Do I have to copy application's database somewhere else to deploy the site?
What are the changes do I have to make in the code to run it properly?
any help would be appreciated!
1) In order for the server to know what the database file (assuming the file is related to microsoft sql) you will need to install microsoft sql on the server.
2) The database should be fine wherever on the server as long as you know where it is.
3) This is a hard question to answer... be more specific?

How to extract the database file when using SQLExpress in Visual Studio

I have made my database in SQLExpress and its a master database . I would like to create a CD for my project so need the database file. I am not able to find that file please suggest a solution
thanks!
Your database files would be in the App_Data folder by default if you are using SQL-Express provided with Visual Studio.
You can generate an SQL script of your database which can be used to re-create it in different db server by running the script again. For this right-click on the database in the Server Explorer and select Publish to Provider.
You'll need the .mdf and .ldf in the SQL Server installation directory, but if you've created everything in the master database, I'd recommend creating a different database and moving everything there instead. The master db shouldn't be used for stuff like that.

SQL server express backend for ASP.NET web service

I come from a linux/apache/php/mysql background. For my current project, I am forced to write web services using ASP.NET. I have installed visual studio and created an ASP.NET web service project. The web service I'm creating will use a SQL database backend. I see that visual studio installed "SQL Server Express 2008." I can see that there is a service called "SQL Server (SQLEXPRESS)" that is running. My question is, how do I run queries against this database? Where's the front end? What tool do I use to create databases and tables? Is there something else I have to install?
I feel completely lost and my google-fu fails me. There are so many different SQL products from microsoft that I can't tell what is the easiest path to just having a simple database with tables I can query from my development machine. With MySQL, I would install the MySQL database, download MySQL query browser and start firing queries at it. How can I do that with Visual Studio/SQL Server Express?
You can download SQL Server Management Studio from here. This is the GUI for working with SQL Server. It will let you create databases, tables, stored procedures, etc. as well as writing queries and manually edit data in the tables.
Aside from SQL Server Management Studio, you can use the Server Explorer tab in Visual Studio (by default on the right side, next to Solution Explorer) to add a data connection. You can do most of the most common database tasks (create/query tables, create views, etc) from there.
there's a command line tool that installs with SQL Server (all versions) called SQLCMD.exe, should be in your install path.
Visual Studio also lets you create dbs, run queries, look at table structures and data (including creating and deleting them, etc), you do that by opening your Server explorer window and making a connection to your local instance (.\SQLExpress by default).
Finally, as the other person mentioned, SQL Server Management Studio Express is a free download, and well worth the time it takes to install.

SQL server won't open DB created by Visual Studio

I've built an ASP.Net site in Visual Studio, and created the DB inside it (the .mdf file is in the APP_data folder).
Now, when I want to deploy in the customer site, I think about maintaining the DB without open Visual Studio, and by using the SQL Server Express tools (back up etc.).
I've searched how to do this, and learned that I should attach the .mdf file to sql server.
I've tried to do this and failed!
The error is: Unable to open the physical file "< .mdf >". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)
Google didn't helped me to solve the problem.
Now I have 2 options:
1. To give up and deploy the site in the current situation where the DB is an .mdf file and ASP.Net can connect to it by the SQL server express compact (in the proccess).
To extract all the data (I need to think how...) and import it to new DB, this time in SQL Server DB.
Wat would you recommend doing?
Thank you in advance.
If on Windows Vista or higher, try opening SQL Server Management Studio by right clicking and saying "Run as Administrator". As Mitch mentioned maybe it is just a permissions issue. Then try attaching to the database.
Error 5 is usually permissions related. Do you have permissions to access the file in it's location?
If you've created it in Visual Studio, it's most likely an Express database. SQL Server does not support "user mode" database connections which SQL Server Express use. Despite sharing a name, they are two fairly distinctive and different technologies.
To view the contents of an SQL Express database (ie- created in Visual Studio) I just use the Visual Studio server explorer.

How can I deploy my ready website?

I have well developed an ASP.NET website with SQL Server 2000. How can I drop it on a server?
You might find these resources helpful:
ASP.NET Web Site Project Deployment Overview
Deploying a Database by Using the Database Publishing Wizard
How to: Deploy a Database With a Web Application Project
Depends on a number of things (e.g. if you have direct access to the server(s)). I tend to export my database structure as a SQL script and execute that against the production database. I then "publish" the site using VS and copy it across to a virtual directory on the web server.
If I am passing the application to a customer, I tend to use WiX or a VS deployment project to wrap the application up in an installer.
You can use SQL Server Publisher (free) wizard for moving database from development machine to the server. Or you can use SQL Server database schema synchronization tool by Red-gate.com
And SitePubisher for deploying files over FTP (and VPN)
There are many ways to do this.
Read this - http://www.beansoftware.com/ASP.NET-Tutorials/Deploy-ASP.NET.aspx

Resources