ASP+联结数据库
时间:2007-01-21 14:13:11
来源: 作者: 点击:次 出处:技术无忧
关键字:ASP+
< %@ 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+文件上传增强实例
下一篇:用c#写的asp+域名查询程序










文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面