TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Displaying the Data in DataGridView
Sandeep Kumar
Dec 29
2015
Code
2.1
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
DataGridView in Ado.
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
using
System.Data.SqlClient;
namespace
WindowsFormsApplication7
{
public
partial
class
Form1: Form
{
public
Form1()
{
InitializeComponent();
}
SqlConnection con =
new
SqlConnection(
"Integrated Security=true;Initial Catalo=TableName;Data source=."
);
Private
void
Page_Load(
object
sender, Event Args e)
{
string
s =
"select * from TableName"
;
SqlDataAdapter Da =
new
SqlDataAdapter(s, con);
Dataset ds =
new
Dataset();
Da.Fill(ds,
"x"
);
DataGridView.DataSource = ds.Tables[0];
DataBind();
}
}
}
DataGridView
ADO.NET
C#