新窗口打开、xml与dataset、字符串取地址、sql不为空

1.新窗口打开

   btnGetInto.Attributes.Add("onclick", "this.form.target='_newName'");

2.

  Webconfig 

3.XML格式的字符串和DataSet之间的相互转换

1).xml转换成DataSet

 

string   strXML   =   "<DataRow><Row   id=\"2\"   name=\"name2\"/><Row   id=\"1\"   

name
=\"name1\"/></DataRow>";   
    
  DataSet   ds   
=   new   DataSet();   
  ds.ReadXml(
new   System.IO.StringReader(strXML));


2).DataSet转换成XML

DataSet   ds   =   new   DataSet();   

string strXML=ds.GetXml(); 

4. 字符串截取-取地址

 

            string url = Request.Url.ToString(); //获取当前页面的URL

            int d=url.LastIndexOf('/'); //获取除最后一个“/”分隔的url长度

            string suburl = url.Substring(0, d); //取出来

 

 

如果测试的url地址是http : //www.test.com/testweb/default.aspx, 结果如下: 

Request.ApplicationPath: /testweb 

Request.CurrentExecutionFilePath: /testweb/default.aspx 

Request.FilePath: /testweb/default.aspx 

Request.Path: /testweb/default.aspx 

Request.PhysicalApplicationPath: E:\WWW\testwebRequest.PhysicalPath: 

Request.PhysicalPath: E:\WWW\testweb\default.aspx 

Request.RawUrl: /testweb/default.aspx 

Request.Url.AbsolutePath: /testweb/default.aspx 

Request.Url.AbsoluteUrl: http://www.test.com/testweb/default.aspx 

Request.Url.Host: www.test.com 

Request.Url.LocalPath: /testweb/default.aspx

 

 eg.

            string url = Request.Url.ToString();

            string path = Request.Path;

            string testcenterUrl = "/UI/Pages/TalentC/TalentCenter.aspx";

            string hostUrl = url.Substring(0, url.Length - path.Length); 

 

 5. SQL不为空

select * from Table

where name is not null 

 

posted @ 2010-11-23 00:32  名字长不够写  阅读(367)  评论(0编辑  收藏  举报