请问以下程序哪里错误了,谢了
using System;
using System.Data;
using System.Data.SqlClient;
namespace DataReaderExample
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
//Specify SQL Server-specific connection string
SqlConnection thisConnection=new SqlConnection("server=172.16.1.98;uid=sa;pwd=;database=Northwind");//SSPI:Security Support Provider Interface
//open connection
thisConnection.Open();
//create SqlCommander for this connection
SqlCommand myCommand=new SqlCommand("SELECT CustomerID,CompanyName from Customers",thisConnection);
//Execute DataReader for specified command
SqlDataReader thisReader=myCommand.ExecuteReader();
//where there are rows to read
while(thisReader.Read())
{
//Output ID and name columns
Console.WriteLine("\t{0}\t{1}",thisReader["CustomerID"],thisReader["CompanyName"]);
}
//close reader
thisReader.Close();
//close connection
thisConnection.Close();
}
}
}