使用C#代码在网格视图中填充值. [英] Fill value in gride view using c# code.

查看:102
本文介绍了使用C#代码在网格视图中填充值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将数据库中的某些记录填充到网格视图的单元格中,但不使用组合框.

I want to fill some records from database into a cell of the grid view but without using combobox.

推荐答案

使用如下代码
字符串con = connectionString此处< ---
string query =您的查询在这里";
SqlDataAdapter da =新的SqlDataAdapter(query,con);
DataTable dt = new DataTable();
da.Fill(dt);
gridView1.DataSource = dt;
gridView.DataBind();
use code as follows
string con=connectionString here<---
string query="your query here";
SqlDataAdapter da = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
da.Fill(dt);
gridView1.DataSource=dt;
gridView.DataBind();


可以详细说明问题吗?


测试以下代码
http://www.exforsys.com/tutorials/asp.net-2.0/asp.net-2.0-the-gridview-control.html [
Test the following code
http://www.exforsys.com/tutorials/asp.net-2.0/asp.net-2.0-the-gridview-control.html[^]


这篇关于使用C#代码在网格视图中填充值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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