请问:c#中sqlServer的连接问题
这是教科书上的一个范例:
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这个数据库。这是怎么回事啊?
问题点数:20、回复次数:4Top
1 楼chenyuming2004(这辈子我算是废了)回复于 2004-05-04 12:56:24 得分 20
看一下SQL SERVER服务器名有没有写错了,用户名和密码对不对了,Top
2 楼alfredbogard(哈哈镜)回复于 2004-05-04 13:01:13 得分 0
是不是数据适配器的原因?Top
3 楼ducadi83((大饼))回复于 2004-05-04 15:12:45 得分 0
谢谢,但是我应该怎么察看我的服务器名称,数据库的名称和密码呢?
Top
4 楼ducadi83((大饼))回复于 2004-05-05 16:39:33 得分 0
已经解决了,谢谢大家:)
Top




