在ASP.NET的C#后台代码中如果有 Console.WriteLine(“你好!”);那么这样才能在页面中显示出来呢,谢谢!!

解决方案 »

  1.   

    Response.Write("Hello" + "<br>");
      

  2.   

    console是控制台程序,怎么可以用在asp.net里呢
      

  3.   


    namespace HowTo.Samples.ADONET
    {using System;
    using System.Data;
    using System.Data.SqlClient;public class readandwritexml
    {
      public static void Main()
      {
        readandwritexml myreadandwritexml = new readandwritexml();
        myreadandwritexml.Run();
      }  public void Run()
      {
        SqlConnection myConnection = new SqlConnection("server=(local)\\NetSDK;Integrated Security=SSPI;database=northwind");
        try
        {
          SqlDataAdapter mySqlDataAdapter1 = new SqlDataAdapter("select * from customers", myConnection);
          SqlDataAdapter mySqlDataAdapter2 = new SqlDataAdapter("select * from orders", myConnection);      DataSet myDataSet = new DataSet();      mySqlDataAdapter1.Fill(myDataSet,"Customers");
          mySqlDataAdapter2.Fill(myDataSet,"Orders");      String strXMLData = myDataSet.GetXml();
          String strXMLSchema = myDataSet.GetXmlSchema();      Console.WriteLine("Select View Source to see XMLSchema");
          Console.WriteLine(strXMLSchema);
          Console.WriteLine("");
          Console.WriteLine("Data");
          Console.WriteLine(strXMLData);
        }
        catch(Exception e)
        {
          Console.WriteLine(e.ToString());
        }
        finally {
          myConnection.Close();           
        }
      }
    }}aspx里面...
    StringWriter writer = new StringWriter();
      Console.SetOut(writer);
      readandwritexml myreadandwritexml = new readandwritexml();
      myreadandwritexml.Run();
      output.InnerHtml = writer.ToString();
      

  4.   

    Response.Write("你好!" + "<br>");
      

  5.   

    你直接在html设计中合适的位置写上去vs200X会帮你自动生成的
      

  6.   

    怎么不好控制呢?HTML干什么用的?Console.WriteLine()!=Response.write()Response.Write()不更好?