简体   繁体   中英

Importing data/database objects into C# database

Forgive me as I'm not very proficient in C# so this question may be incorrect. I have created a database in the App_Data folder in C# and from the Web.Config file it appears to be SQL Express. I'm assuming that based on this entry:

  <connectionStrings>
    <add name="ApplicationServices" 
         connectionString="data source=.\SQLEXPRESS;
         Integrated Security=SSPI;
         AttachDBFilename=|DataDirectory|\aspnetdb.mdf;
         User Instance=true" providerName="System.Data.SqlClient" />

However, I don't see SQL Server Express installed on my machine. When I click on the database in the App_Data folder, the upper left of my screen looks like this:

在此处输入图片说明

What I'd like to do is run some scripts I copied from a SQL Server database which will create a few stored procedures, views and functions, as well as set up the table structures. Ideally I'd also like to import my data, which I copied from my old SQL Server into an Access db. I can't seem to find a screen where you can do this. If I right-click on the database and select the Create Query menu item, it wants to create a query like in Access. I don't see any screen where I can run my script.

How do I do this in C#?

From the Server explorer, you should be able to right-click on the database name, and select "New Query".

In the new query window that appears, paste the script that you copied from the other SQL database instance.

Once pasted, click the "Execute" button at the top of the query window.

Hope this helps.

Cheers

I got it. You need to click on the Data menu, then Transact SQL Editor, then New Query Connection.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM