在asp.net中将两个表绑定到gridview [英] In asp.net Bind two table to gridview

查看:83
本文介绍了在asp.net中将两个表绑定到gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在社交网络项目中,查找所有朋友的电子邮件,从一个表格和所有朋友的电子邮件帖子在gridview中显示电子邮件,可在会话

In social networking project find all friend email from one table and all friend email post show in gridview with email which is available in session

推荐答案

if(会话[电子邮件]!= null)

{

//对你的数据结构或你分配给它的任何东西进行类型转换

DataTable ds =(DataTable)会话[email];

da = new SqlDataAdapter(Select * from Table1,con);

da.Fill(ds1,Record);

ds1.Merge(ds);

GridAllRecord.DataSource = ds1;

GridAllRecord.DataBind();



}
if(Session[email]!=null)
{
//typecast it to your datastructure or whatever you assigned into it
DataTable ds= (DataTable)Session[email];
da = new SqlDataAdapter("Select * from Table1", con);
da.Fill(ds1, "Record");
ds1.Merge(ds);
GridAllRecord.DataSource = ds1;
GridAllRecord.DataBind();

}


这篇关于在asp.net中将两个表绑定到gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆