VS2005 CONNECTIONSTRING AND APPSETTING

/  WEB.CONFIG



 
   
 

 
   
   


//  INTERFACE.CS 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

///


/// myInterface 的摘要说明
///

 public interface  myInterface
{
     void SayHello(string sName);
     void GetMyname(string sName);
}

 

///  CODDING.CS

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page,myInterface
{
    private string strName = "";

    protected void Page_Load(object sender, EventArgs e)
    {

        SayHello("cqs");
        GetMyname("cqs");
    }

    protected void Page_Init(object sender, EventArgs e)
    {
        Response.Write(System.Configuration.ConfigurationManager.AppSettings[0].ToString()+"
");
        Response.Write(System.Configuration.ConfigurationManager.ConnectionStrings["val"].ToString()+ "
");
    }

    protected void Button1_Click(object sender, EventArgs e)
    {

    }

    public void SayHello(string astr)
    {
        Response.Write("hello " + astr+"
");
    }

    public void GetMyname(string astr)
    {
        Response.Write("get " + astr);
  }

}

你可能感兴趣的:(C#)