Click here to Skip to main content
12,630,420 members (30,723 online)
Rate this:
 
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 2: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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2016
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