三度网教程:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

ASP+联结数据库

时间:2024-1-29作者:未知来源:三度网教程人气:


< %@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>

<html>

< 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() + "<br> " ); } }

</script>

<body>

</body>
</html>


</td>
</tr>
</table>
</body>


关键词:  ASP+联结数据库





Copyright © 2012-2018 三度网教程(http://www.3du8.cn) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版