Question

I was trying to upload the database of my ASP.NET website. On the local machine, if I copy the database from another machine, I have to attach it through SQL Server Management Studio and then use it in the connection string like

<add name="cn" connectionString="Data Source=.\sqlexpress;Initial Catalog=database;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient"/>

My database is approx. 10 MB in size for now. If I upload it via ftp to App_Data folder, how would I have to attach this database?

In Plesk, I have the option to create the database and its user (as shown in the screenshots):

1) Web Applications and services-Plesk alt text

2) Add New Database alt text and add new database user

3) Webadmin>ASP.ET Enterprise Manager alt text

But this is for the new database I created. My problem is to upload an existing one.

There's also a section in Plesk for ASP.NET settings (as shown below) alt text This has the option to change the connection string etc.

I also asked my hosting provider about the method to be followed for attaching the database that I would upload. This was the reply in quote.

mdf ldf files perhaps will be working at your local computer but this way database of mssql will not work on web server as on web server you will be required to create and restore your database backup file using plesk control panel.

Sample connection string for asp.net mssql Standard Security: "Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;UserId=Your_Username;Password=Your_Password;"

Server name to be used in coding: localhost Catalog/ database name , database user and database password you will be required to create your own using plesk control panel"[/quote]

I would be really be appreciative for the steps I have to take to upload my existing database. How do I have attach it? What connection string I have to use? Thanks!

Was it helpful?

Solution

Can you run a sql script on your "new" database in Plesk? If so, you can script the object creation and data in your existing db and execute it thusly. In SSMS:

  1. Right click db.
  2. Tasks...
  3. Generate scripts.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top