using System.Data.SqlClient;
SqlConnection cnn = new SqlConnection("Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;");
cnn.Open();
SqlCommand cmd = new SqlCommand("SELECT FirstName,LastName FROM Employees WHERE EmployeeID = 1", cnn);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
textBox1.Text = dr.GetString(0);
textBox2.Text = dr.GetString(1);
}
}
cnn.Close();
Hiç yorum yok:
Yorum Gönder