asp.net中的gridview c# [英] gridview in asp.net c#

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

问题描述

如何从拖表填充一个gridview

首先如下

 OleDbConnection con =  new  OleDbConnection(configurations.constring()); 
OleDbDataAdapter dt = new OleDbDataAdapter(strSQL,con);
DataSet ds = new DataSet();
dt.Fill(ds);
con.Close();
GridView1.DataSource = ds;
GridView1.DataBind();





第二个如下



 OleDbConnection con =  new  OleDbConnection(configurations.constring()); 
OleDbDataAdapter dt = new OleDbDataAdapter(otherstrSQL,con);
DataSet ds = new DataSet();
dt.Fill(ds);
con.Close();
GridView1.DataSource = ds;
GridView1.DataBind();

解决方案

您还可以查看嵌套网格视图 -

http://www.aspdotnet-suresh.com/ 2012/05 / gridview-with-in-gridview-or-nested.html [ ^ ]

嵌套的GridViews与ASP.NET中的皮肤 [ ^ ]


你可以使用join和get结果来自gridview中的两个表。请参阅这些链接。



加入表和查询[office.microsoft.com] [ ^ ]



结合几个选择的结果使用联合查询进行查询 [ ^ ]



Microsoft Query中联接使用的描述 [ ^ ]



Reg ARDS ..:)

how can I fill one gridview from tow table
first as following

OleDbConnection con = new OleDbConnection(configurations.constring());
        OleDbDataAdapter dt = new OleDbDataAdapter(strSQL , con);
        DataSet ds = new DataSet();
        dt.Fill(ds);
        con.Close();
        GridView1.DataSource = ds;
        GridView1.DataBind();



the second as following

OleDbConnection con = new OleDbConnection(configurations.constring());
        OleDbDataAdapter dt = new OleDbDataAdapter(otherstrSQL , con);
        DataSet ds = new DataSet();
        dt.Fill(ds);
        con.Close();
        GridView1.DataSource = ds;
        GridView1.DataBind();

解决方案

You can also take a look at nested gridviews -
http://www.aspdotnet-suresh.com/2012/05/gridview-with-in-gridview-or-nested.html[^]
Nested GridViews with Skins in ASP.NET[^]


You can make use of join and get result from two tables in a gridview. Refer to these links.

Join tables and queries [office.microsoft.com][^]

Combine the results of several select queries by using a union query[^]

Description of the usage of joins in Microsoft Query[^]

Regards..:)


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

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