You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio无法找到数据库作为数据连接,编程新手求助

Hey there! Let's break down these two issues you're facing step by step—since you're just starting out, these are super common hurdles, so don't stress!

Since the official link isn't working for you, let's manually grab and attach a sample database instead. Here's how:

  • First, download a widely-used sample database like AdventureWorks or Northwind (these are free, official resources from Microsoft).
  • Once downloaded, open SQL Server Management Studio (SSMS), connect to your local SQL Server instance (usually (local) or .\SQLEXPRESS).
  • Right-click on the Databases folder in the Object Explorer, select Attach....
  • In the Attach Databases window, click Add..., navigate to the downloaded .mdf file of the sample database, and follow the prompts to complete the attachment.
Issue 2: No available options in the data connection dropdown

This usually boils down to missing components or incorrect setup. Try these fixes:

  • Check if the SQL Server service is running: Open the Windows Services app (press Win + R, type services.msc), find the service named SQL Server (SQLEXPRESS) (or your specific instance name), and make sure it's set to "Running". If not, right-click and start it.
  • Install required Visual Studio components: Open Visual Studio Installer, go to your installed workloads, and ensure you have the Data storage and processing workload checked. This installs the necessary drivers and tools for database connections.
  • Select the correct data source type: When adding a connection in Visual Studio, click the Change... button next to the data source field, and select Microsoft SQL Server from the list. If this option isn't present, the missing workload mentioned above is likely the issue.
  • Verify your server instance name: When setting up the connection, use the correct instance name—for a default local installation, this is usually .\SQLEXPRESS or (localdb)\MSSQLLocalDB (for the lightweight LocalDB instance).

Once you've sorted these steps, you should be able to create the data connection and continue with your program!

内容的提问来源于stack exchange,提问作者Chris A

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:45:23