最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net数据连接代码
时间:2022-07-02 10:51:15 编辑:袖梨 来源:一聚教程网
< %@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>
< script language="C#" runat="server">
' 声明C#
public DataSet dsCustomer;
protected void Page_Load(Object Src, EventArgs E )
{
' 在打开页面时连接数据库
SQLConnection myConnection = new SQLConnection
("server=sql2.bitsonthewire.com;uid=joeuser;pwd=joeuser;database=northwind");
SQLDataSetCommand CustomersDSCommand = new SQLDataSetCommand("select * from customers", myConnection);
dsCustomer = new DataSet();
CustomersDSCommand.FillDataSet(dsCustomer,"Customers");
foreach (DataRow Customer in dsCustomer.Tables["Customers"].Rows)
{
Response.Write(Customer["CustomerId"].ToString() + "
" ); } }
相关文章
- 金铲铲之战幻灵武器选择推荐 07-01
- 崩坏星穹铁道斯缇科西亚若虫位置一览 07-01
- 洛克王国世界机甲小子捕捉方法 07-01
- XRoad(XRI币)排名是什么 07-01
- 金铲铲之战s14街头恶魔主c阵容构筑推荐 07-01
- 魔兽世界11.1雷鼓哑炮火箭怎么获得 07-01