文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>新窗口打开、xml与dataset、字符串取地址、sql不为空

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

时间:2010-11-23  来源:名字长不够写

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 

 

排行榜 更多 +
备忘录记事本

备忘录记事本

生活实用 下载
梦幻甜心蛋糕店手游 v1.0 安卓版

梦幻甜心蛋糕店手游 v1.0 安卓版

休闲益智 下载
狙击手血战鬼子 v8081.23.10.7 安卓版

狙击手血战鬼子 v8081.23.10.7 安卓版

休闲益智 下载