943,913 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 13259
  • C# RSS
Feb 9th, 2009
0

How to show data in Datagridview in C#

Expand 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
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
Abhishek_Boga is offline Offline
20 posts
since Feb 2009
Feb 9th, 2009
0

Re: How to show data in Datagridview in C#

Well, what have you tried so far? the helpfile has full examples of putting data in a datagrid
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Feb 9th, 2009
0

Re: How to show data in Datagridview in C#

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..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
afaque_khan1 is offline Offline
3 posts
since Feb 2009
Feb 9th, 2009
0

Re: How to show data in Datagridview in C#

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.
Reputation Points: 165
Solved Threads: 59
Posting Pro in Training
DangerDev is offline Offline
485 posts
since Jan 2008
Feb 11th, 2009
0

Re: How to show data in Datagridview in C#

hi,

thank you. this one is i needed,

please marked this thread as solved
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
karthi_selva is offline Offline
65 posts
since Oct 2008
Feb 14th, 2009
0

Re: How to show data in Datagridview in C#

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();
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
skc23 is offline Offline
1 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: How do you make a heart shaped control ?
Next Thread in C# Forum Timeline: multiplying two text boxes and putting answer in third text box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC