I keep getting an error: System.Data.SqlClient.SqlDataReader.
Any idea on why this error is arising?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data.Sql;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string strconn = "SERVER=22.3.1.9;User=CHMSE;password=18465!JFKi8nis;Database=CFOH";
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select address1 from lalocation where servicenumber < 11";
SqlDataReader reader = cmd.ExecuteReader();
/* while (reader.Read())
{
Console.WriteLine(reader[0].ToString() + " " + reader[1].ToString());
}
*/
conn.Close();
Console.WriteLine(reader);
Console.ReadLine();
}
}
}