我们如何从sql server中显示网格视图中的数据 [英] how we dispaly data in grid view from sql server
本文介绍了我们如何从sql server中显示网格视图中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何在sql server中显示网格视图中的数据
how we dispaly data in grid view from sql server
推荐答案
hi !!!
hi!!!
on button click event
{
con.Open();//connection open
SqlCommand cmd = new SqlCommand("Select * from tablename", con);
// SqlCommand cmd = new SqlCommand(hidSelectedText.Value, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
con.Close();
}
请显示您尝试过的代码。
你需要为该操作编码。你需要运行你的Sql查询。
String Command =从表中选择*(表名);
SqlDataadapter da = new SqlDataadapter(Command,Con); //(连接对象)
数据集ds = new Dataset();
da。 fill(ds);
Gridview.DataSource = ds.Tables [0];
谢谢
Please show the Code that you have tried.
You need to code for that operation.You need to run your Sql query.
String Command="Select * from table(Name of table)";
SqlDataadapter da=new SqlDataadapter(Command,Con);//(Connection Object)
Dataset ds=new Dataset();
da.fill(ds);
Gridview.DataSource=ds.Tables[0];
Thanks
这篇关于我们如何从sql server中显示网格视图中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文