1
Answer

connection oriented in windows forms

Srikanth Reddy

Srikanth Reddy

11y
849
1
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)