Srikanth Reddy

Srikanth Reddy

  • NA
  • 1.7k
  • 166k

connection oriented in windows forms

Oct 2 2013 2:55 AM
hai friends,
I am a learner...
I am comparing connection oriented in both win-forms & web-forms.
Here is my code...

Web-Forms
----------------------------------------------------------------------------------------------------------------------------
SqlConnection con = new SqlConnection("server=.;database=test;trusted_connection=true");
con.Open();
SqlCommand cmd = new SqlCommand("select * from employee",con);
SqlDataReader dr = cmd.ExecuteReader();
dataGridView1.DataSource = dr;
con.Close();
---------------------------------------------------------------------------------------------------------------------------

I got the output.



Win-Forms
--------------------------------------------------------------------------------------------------------------------------------
SqlConnection con = new SqlConnection("server=.;database=test;trusted_connection=true");
con.Open();
SqlCommand cmd = new SqlCommand("select * from employee",con);
SqlDataReader dr = cmd.ExecuteReader();
dataGridView1.DataSource = dr;
con.Close();
-----------------------------------------------------------------------------------------------------------------------------------
I dint get the output. 
Why?


Please answer this.....................


Answers (1)