最新下载
热门教程
- 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() + "
" ); } }
相关文章
- 疾风骑士斗士有什么玩法技巧 08-25
- 斗罗大陆猎魂世界魂师篇章如何推进 08-25
- 梦想世界长风问剑录回春药师攻辅流怎么搭配 08-25
- 迷你世界哪些地形物资比较丰富 08-25
- 星塔旅人塔菲如何搭配队伍 08-25
- 物华弥新水晶杯有什么技能 08-25