Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows
Hi to All,
 

i want to display some table details in datagridview with query by using c# language.please help with some code..
Posted 19-Nov-12 1:08am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

static string ConStr = @"Data Source=ROHIT-PC\SQLEXPRESS;Initial Catalog=MPAdvisor;Integrated Security=True";
        SqlConnection con = new SqlConnection(ConStr);
 
string query = "select * from users";
 
            SqlDataAdapter da = new SqlDataAdapter(query, con);
            DataTable dt = new DataTable();
            da.Fill(dt);
           
            GridView1.DataSource = dt;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.141022.2 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100