新手,希望大虾多帮忙
下面代码是我借鉴——操作数据库的代码,请问要怎么执行,后缀要取什么?我用的开发工具是VS。NET 2003
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>
<html>
<head>
<script language="C#" runat="server">
public SQLDataReader myReader;
public String html;
protected void Page_Load(Object Src, EventArgs E ) {
SQLConnection mySQLConnection = new SQLConnection("server=localhost;uid=sa;pwd=;database=northwind");
SQLCommand mySQLCommand = new SQLCommand("select * from customers", mySQLConnection);
try {
mySQLConnection.Open();
mySQLCommd.Execute(out myReader);
html="<Table>";
html+="<TR>";
html+="<TD><B>Customer ID</B> </TD>";
html+="<TD><B>Company Name</B></TD>";
html+="</TR>";
while (myReader.Read()) {
html+="<TR>";
html+="<TD + myReader["CustomerID"].ToString() + "</TD>";
html+="<TD>" + myReader["CompanyName"].ToString() + "</TD>";
html+="</TR>";
}
html+="</Table>";
}
catch(Exception e) {
html=e.ToString();
}
finall y {
meader.Close();
mySQLConnection.Close();
}
Response.Write(html);
}
</script>
</head>
<body>
</body>
</html>