class Program { static void Main(string[] args) {
string conn = @"Data Source=.\SQLEXPRESS;Initial Catalog=usersdb;Integrated Security=True";
conn.Open();
SqlCommand cmd = new SqlCommand(“SELECT * FROM [dbo].[SalesLog]”,conn);
SqlDataReader reader=cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(“{0},{1}”,reader.GetInt32(0), reader.GetString(1));
}
Reader.Close();
Conn.Close();
Console.ReadLine();
}
}
Do'stlaringiz bilan baham: |