我怎样才能从sqlserver中检索表数据,它必须在asp gridcontrol中设置为bibd [英] how can i retrieve table data from sqlserver and it must bibd in asp gridcontrol

查看:93
本文介绍了我怎样才能从sqlserver中检索表数据,它必须在asp gridcontrol中设置为bibd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi gurus plz给我答案.

hi gurus plz give me the answer.

推荐答案

尝试一下...
Try This...
SqlConnection con = new SqlConnection("Data Source=(local);Database=UrDatabaseName;uid=sa;pwd=sa");


con.Open();


string Query = "Select * from Employee";


SqlDataAdapter da = new SqlDataAdapter(Query, con);


DataTable DT = new DataTable();


da.Fill(DT);


GridView2.DataSource = DT;
GridView2.DataBind();


在此处阅读有关ADO.NET的信息,它将对您有所帮助.

看看这些:
MSDN:ADO.NET [ MSDN:使用ADO.NET访问数据 [ ^ ]

C#Station ADO.NET教程 [为初学者使用ADO.NET [
Read about ADO.NET here and it will help you.

Look at these:
MSDN: ADO.NET[^]
MSDN: Accessing Data with ADO.NET[^]

The C# Station ADO.NET Tutorial[^]
Using ADO.NET for beginners[^]


这篇关于我怎样才能从sqlserver中检索表数据,它必须在asp gridcontrol中设置为bibd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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