请问:c#中sqlServer的连接问题

ducadi83 ducadi83 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这是教科书上的一个范例:
using System;
using System.Data;
using System.Data.SqlClient;

namespace DataSetRead
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// Specify SQL Server-specific connection string
SqlConnection thisConnection = new SqlConnection(
@"Data Source=dougp\dogdata;uid=sa;password=datadog;" +
"Initial Catalog=northwind");

// Create DataAdapter object for update and other operations
SqlDataAdapter thisAdapter = new SqlDataAdapter(
"SELECT CustomerID, CompanyName FROM Customers", thisConnection);

// Create DataSet to contain related data tables, rows, and columns
DataSet thisDataSet = new DataSet();

// Fill DataSet using query defined previously for DataAdapter
thisAdapter.Fill(thisDataSet, "Customers");

foreach (DataRow theRow in thisDataSet.Tables["Customers"].Rows)
{
Console.WriteLine(theRow["CustomerID"] + "\t" +
theRow["CompanyName"]);
}


}
}
}
但是编译通过后,执行时会提示msvcr.dll/msvcp.dll找不到。
我明明在运行sqlserver,而且也检查了有northwind这个数据库。这是怎么回事啊?
...全文
评论 4
收藏 已收藏
分享
返回顶部
ducadi83
C# 111,129 成员 642,539 内容