刚学C# 有很多不懂的地方 希望高手帮忙解答:
SqlConnection conn = new SqlConnection("server=192.168.0.46;database=pubs;User Id=sa;pwd=123456");
SqlCommand cmd = new SqlCommand("SELECT * FROM employee", conn);
try
{
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine("First Name: {0}, Last Name: {1}", reader.GetString(0), reader.GetString(1));
}
reader.Close();
conn.Close();
}
catch (Exception e)
{
Console.WriteLine("Exception Occured -->> {0}", e);
}