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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prabu Spark
NA
124
203.8k
what is the use of relations in dataset c#
Jul 1 2013 5:01 AM
Hi sir,
Tell me the use of relations in dataset c# . I made relation using two datatables, for a dataset.
My problem is what is the use of datarelations in datasets. Kindly give me the solution with proper
examples.
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["con"].ConnectionString);
SqlCommand cmd;
con.Open();
string query = "select * from emp";
DataSet ds = new DataSet();
cmd = new SqlCommand(query, con);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
sda.Fill(ds, "emp");
cmd.Dispose();
string query1 = "select * from empl";
cmd = new SqlCommand(query1, con);
sda.SelectCommand = cmd;
sda.Fill(ds, "empl");
ds.Relations.Add("employees_list", ds.Tables["emp"].Columns["eid"], ds.Tables["empl"].Columns["eid"],false);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
Reply
Answers (
3
)
More than one Image displaying using Http handler
confirmation link in user registration without createuserwiz