Hi! i wanna access sql database through my C# console app. but it don't produce output.
plz see my code
Code:
static void Main(string[] args)
        {
            string source =@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWIND.mdf;Integrated Security=True;User Instance=True";



            string query = "Select * from Customers";
            SqlConnection conn = new SqlConnection(source);
            try
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(query, conn);

                int rowaffected = cmd.ExecuteNonQuery();

                if (rowaffected != 0)
                    Console.Write(rowaffected.ToString());////output
                else
                    Console.Write("No row affected");
            }
            catch (SqlException e)
            {
                Console.Write(e.ToString());
            }
            finally
            {
                conn.Close();
            }
            
           

        }
I have placed a database Northwind.mdf in C:\SQL Server 2000 Sample Databases folder, and i have added a dataconnection to this through server Explorer.

Please tell me where i am wrong ?? why it don't give output.