使用asp.net在gridview中绑定多个数据集 [英] Bind multiple dataset in a gridview using asp.net

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

问题描述

嗨朋友我需要帮助



如何使用asp.net在单个网格视图中使用多个数据集

对于egs:前三个三个单元格填充一个数据集,其余数据集填充其他数据集。

如果是这样,如何...

还有其他任何解决方案。 ..



问候

Sushil Dharmar

解决方案

网格只能绑定到一个DataSource,因此您需要合并它们或构造一个必需元素。


您好,

您需要合并这些数据集并绑定结果数据集给你的控件,看看这篇文章:

如何合并两个数据集 [ ^ ]



我希望它有所帮助,

干杯

嗨朋友....

将数据集绑定到网格视图的代码

------------ ---------------------------------------

SqlConnection con = new SqlConnection(xyz);

string str =select colmn1,colmn2 from tablename;

SqlDataAdapter da = new SqlDataAdapter(str,con);

DataSet ds = new DataSet();

da.Fill(ds);

GridView1.DataSource = ds;

GridView1.DataBind();

---------------------------- -----------------------

享受......


Hi Friends I need an help

How to use multiple dataset in a single grid view using asp.net
For egs: the first 3 three cells is filled wid one dataset and the rest with other dataset..
If so den how...
is there any other solution either than this...

Regards
Sushil Dharmar

解决方案

The grid can only be bound to one DataSource so you would need to either merge them or construct one with the elements necessary.


Hi,
You need to merge those datasets and bind the resulting dataset to your control, take a look at this post:
how to merge two data set[^]

I hope it helps,
Cheers


Hi Friends....
Code for Binding Dataset to Grid View
---------------------------------------------------
SqlConnection con = new SqlConnection(" xyz");
string str = "select colmn1,colmn2 from tablename";
SqlDataAdapter da = new SqlDataAdapter(str,con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
---------------------------------------------------
Enjoy......


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

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