Computers & Internet Logo

Related Topics:

Posted on Jun 20, 2008
Answered by a Fixya Expert

Trustworthy Expert Solutions

At Fixya.com, our trusted experts are meticulously vetted and possess extensive experience in their respective fields. Backed by a community of knowledgeable professionals, our platform ensures that the solutions provided are thoroughly researched and validated.

View Our Top Experts

C# datagrids hi!! I'm new to c# and my problem is i need to display column names of a table(from sqlserver) in the datagrid. can u help me?

  • sunny11 Jun 26, 2008

    yes..VS 2003

  • Chris Gladden
    Chris Gladden May 11, 2010

    Are you using Visual Studio? .net?

×

2 Answers

brightjijin

Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Governor:

An expert whose answer got voted for 20 times.

New Friend:

An expert that has 1 follower.

  • Expert 42 Answers
  • Posted on Feb 14, 2019
brightjijin
Expert
Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that got 5 achievements.

Governor:

An expert whose answer got voted for 20 times.

New Friend:

An expert that has 1 follower.

Joined: Apr 23, 2010
Answers
42
Questions
0
Helped
7545
Points
130

You can try the below snippet
SqlConnection
cn = new SqlConnection( "Data Source=SQlHS;Initial Catalog=DB;Integrated Security=True"); cn.Open(); SqlCommand cm = new SqlCommand("SELECT *FROM mytable");
cm.Connection = cn; SqlDataAdapter da = new SqlDataAdapter(cm); DataTable dt = new DataTable(); da.Fill(dt); cn.Close(); dataGridView1.DataSource = dt;

Anonymous

Level 1:

An expert who has achieved level 1.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

  • Contributor 4 Answers
  • Posted on Jun 30, 2008
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

Corporal:

An expert that has over 10 points.

Mayor:

An expert whose answer got voted for 2 times.

Joined: Jun 30, 2008
Answers
4
Questions
0
Helped
24980
Points
12

Follow these steps :-

1. Create a connection.
2. Fire the select query and fill the records in the dataset.
3. Bind the dataset with the grid.

Ad

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

0helpful
1answer

Sum numbers in a column down until you come to a blank, then start again

Sounds like your issue can be solved readily with a pivot table.
If you give the columns of names a title like "NAME" and the number columns a name like "VALUE". All other columns should contain a unique name.

Then select the entire table, including the labels at the top ensuring that the range extends entirely over the column you need to sum the values of.

In Excel 2013, choose the INSERT menu and select the PIVOT TABLE command.
Insert the Pivot table into a new worksheet.
A new sheet will open with a strange-looking control panel on the right of the window.
Make sure that the box for NAME and VALUE (only) are checked

You will notice that Excel assumes that you want the SUM of the values for each NAME summed. The results are in the leftmost area of the worksheet.

If this works for you, please vote my answer as "helpful".
0helpful
1answer

How to build a datagrid with master detail relationship in php

I also don't have much experience in the PHP, however, I think you can try some convenient datagrid like the UI GridView Control for WinForms I've heard before.
0helpful
1answer

I have a visual basic program in which i have to display the record from access table by using connection of adodc.and then select record from datagrid will display in another form. plz reply as soon as...

hi,  you may visit this site www.kidwaresoftware.com/ and download all free visual basic source codes with tutorials..  One of the source code will solve your problem.    However their paid Visual basic source codes will most powerful.    As I am total deaf and no source to communicate others... I want to share the  payment source codes with tutorials from  www.kidwaresoftware.com/.  Are you ready... If you download the  source codes with tutorials (only Fee for it) I will share with you.    [email protected]
0helpful
1answer

A nice datagrid in vb.net

You'd better me more familiar with the C# DataGrid Header. I reckon that this would do you some help.
0helpful
4answers

Setting Datagrid runtime in Visual Basic

I think you are missing this at the end:

DataGrid1.DataBind()
1helpful
2answers

Howto load data to datagrid using visual basic 2005 and sql 200

May I suggest providing us with the programming language enviroment, which you're using, as in, Visual Basic or something, that way, I think it would be easier for the experts to give you an answer.

Here is a helpful link about Databases, but it's for Visual Basic Express Edition 2008
http://msdn2.microsoft.com/en-gb/express/aa718391.aspx


The best of luck with your project.
0helpful
1answer
0helpful
2answers

Datagrid

Hi All I have a Data-grid with 3 columns. One is Text Name, second is Image which denotes Offline/Online User Status. Third Image Denotes Blocked/UnBlocked User Status. Now, I want to change Image on Click. If User1 wants to leaves the chat, Then he clicks on Image in front of his name. Here the images should be changed. And a function userOffline should be called. The function is called on Click but Image does not change. If I try to change the image it changes all images in the Column of all users. Can any one help
0helpful
1answer

Vlookup

Hi Ralph, On the first table If the name is in column A and dept is in B. Suppose the new names are in column D here's the formula =vlookup(D1,A:B,2,0) Note a few things - 1. You will only receive the 1st departament. 2. In case that the name in D doesn't appear in A you'll get N/A. This can be solved using the following formula: =if(type(vlookup(D1,A:B,2,0))=16,"",vlookup(D1,A:B,2,0)) Let me know if there's anything else. D.
Not finding what you are looking for?

100 views

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

Grand Canyon Tech
Grand Canyon Tech

Level 3 Expert

3867 Answers

k24674

Level 3 Expert

8093 Answers

Brad Brown

Level 3 Expert

19187 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...