How to show data in Datagridview in C#

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 15
Reputation: Abhishek_Boga is an unknown quantity at this point 
Solved Threads: 0
Abhishek_Boga Abhishek_Boga is offline Offline
Newbie Poster

How to show data in Datagridview in C#

 
0
  #1
Feb 9th, 2009
Hi, im not getting of how to vies the data in the database when user select the cndidate id from combobox and the data should be shown in the datagridview. let me know the source code of the problem..


Regards,
Abhishek
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: How to show data in Datagridview in C#

 
0
  #2
Feb 9th, 2009
Well, what have you tried so far? the helpfile has full examples of putting data in a datagrid
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3
Reputation: afaque_khan1 is an unknown quantity at this point 
Solved Threads: 0
afaque_khan1 afaque_khan1 is offline Offline
Newbie Poster

Re: How to show data in Datagridview in C#

 
0
  #3
Feb 9th, 2009
Originally Posted by Abhishek_Boga View Post
Hi, im not getting of how to vies the data in the database when user select the cndidate id from combobox and the data should be shown in the datagridview. let me know the source code of the problem..


Regards,
Abhishek
it is simple
all you have to do is add columns in the data grid form the UI. Then in the code you need to assign the value as

dataGridView1.Rows.Add(<value>,<value>,<value>,.....);
the no of value will be equal to the no of columns and you have to give string values.....

i hope this solves your prob..
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 483
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 59
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: How to show data in Datagridview in C#

 
0
  #4
Feb 9th, 2009
you can also assign DataGridView's DataSource property any data source like dataTable it will take care of creating required column and filling data.
Try out any of the solution given here in thread, and if any problem get back. If you will tell what so far you have done as LizR told, it will be helpful for us to understand your problem.
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 56
Reputation: karthi_selva is an unknown quantity at this point 
Solved Threads: 0
karthi_selva karthi_selva is offline Offline
Junior Poster in Training

Re: How to show data in Datagridview in C#

 
0
  #5
Feb 11th, 2009
hi,

thank you. this one is i needed,

please marked this thread as solved
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1
Reputation: skc23 is an unknown quantity at this point 
Solved Threads: 0
skc23 skc23 is offline Offline
Newbie Poster

Re: How to show data in Datagridview in C#

 
0
  #6
Feb 14th, 2009
Originally Posted by Abhishek_Boga View Post
Hi, im not getting of how to vies the data in the database when user select the cndidate id from combobox and the data should be shown in the datagridview. let me know the source code of the problem..


Regards,
Abhishek
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Data : System.Web.UI.Page
{
SqlConnection con;
SqlDataAdapter sda;
DataSet ds;

protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection();
con.ConnectionString = "Data Source=.;Database=Train;User Id=sa;Password=chi";
con.Open();

sda = new SqlDataAdapter("select * from RegistrationForm", con);
ds = new DataSet();
sda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC