下面代码是我借鉴——操作数据库的代码,请问要怎么执行,后缀要取什么?我用的开发工具是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>

解决方案 »

  1.   

    就是我想知道怎么执行这代码,我是刚刚接触。NET,不知道把这代码写在哪里?
      

  2.   

    后缀名是.aspx
    在服务器创建一个虚拟目录;然后浏览这个.aspx文件就可以了!
      

  3.   

    在web服务器上,鼠标右键--〉创建虚拟目录到你的项目文件
      

  4.   

    在web服务器上,鼠标右键--〉创建虚拟目录到你的项目文件
    ------------
    我还是不知道怎么做,能麻烦你说的详细点吗?我的机器上好象没装IIS的,是不是不能创建虚拟目录?