datareader 问题!!
SqlConnection dataConnection = new SqlConnection();
try
{
dataConnection.ConnectionString = "server=YJY3;database=xtreme;uid=sa;pwd=123456 ";
dataConnection.Open();
Console.Write( "请输入地区代码: ");
string Id = Console.ReadLine();
SqlCommand datacomand = new SqlCommand();
datacomand.Connection = dataConnection;
datacomand.CommandText =
"select 地区代码,地区描述,地区所属 " +
"from 地区元数据 " +
"where 地区代码 = ' " + Id + " ' ";
Console.WriteLine( "About to execute:{0}\n\n ", datacomand.CommandText);
SqlDataReader dataReader = datacomand.ExecuteReader();
while (dataReader.Read()) ###问题所在之处###
{
string aId = dataReader.GetString(0);
string country = dataReader.GetString(1);
string org = dataReader.GetString(2);