现在的位置: 首页 > 综合 > 正文

.net不熟悉代码

2013年03月20日 ⁄ 综合 ⁄ 共 3022字 ⁄ 字号 评论关闭

---------------------------------------------------------
直接取字符串的前14个字符,AEECSS不能用substring
select case when len(a.newstitle)>14 then substring( a.newstitle ,0,14) else a.newstitle end  as NewsTitle,a.newstitle as NewsToolTips,b.subjectmoduleid as moduleid,c.SubjectID,d.TemplateID from t_article a inner join t_articlesubject b on a.newsid=b.articleid inner join t_subjectmodule  c on b.subjectmoduleid=c.moduleid inner join t_subject d on c.subjectid=d.subjectid

---------------------------------------------------------
<%# DataBinder.Eval(Container.DataItem,"Date","发布时间:{0:yyyy-MM-dd hh:mm}"%>

---------------------------------------------------------
 <appSettings>
  <add key="ConnectionString" value="server=192.168.0.1;Integrated Security=false;user   id=sa;password=;database=Archives" />
 </appSettings>

---------------------------------------------------------
select @OutID=@@IDENTITY
---------------------------------------------------------
SELECT a.NewsID,f.articletypename as type2,e.articletypename as grandgrandmother,d.articletypename as granther,c.articletypename as ParentName ,a.NewsTitle,a.NewsAuthor,a.NewsFrom,b.ArticleTypeName,a.NewsForeWord,a.NewsTop,a.NewsNew, a.ClickNum,a.Filltime,a.NewsContent,a.NewsPic,a.IsCheck,a.OrgID,a.DoTypeID,a.MainTypeNum,a.NewsOrder
from t_article a
left join t_articletype b on a.articletypenum=b.articletypenum
left join t_articletype c on b.parentnum=c.articletypenum
left join t_articletype d on c.parentnum=d.articletypenum
left join t_articletype e on d.parentnum=e.articletypenum
left join t_articletype f on a.dotypeid=f.articletypenum
where rtrim(a.orgid)<>''and a.dotypeid<> '' and a.ischeck=1
order by a.NewsTop desc,a.NewsNew desc,a.filltime desc
---------------------------------------------------------

<%# DataBinder.Eval(Container.DataItem,"ID")%>

SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

---------------------------------------------------------

Regex.Split(rd["FieldValue"].ToString(),",,",RegexOptions.IgnoreCase);
---------------------------------------------------------
从RGB中取得颜色
System.Drawing.Color errorcolor = ColorTranslator.FromHtml("#F7CFB5");

利用正则表达式来验证字符串
//是否数字
  public bool IsWholeNumber(String strNumber)
  {
   Regex objNotWholePattern=new Regex("[^0-9]");
   return !objNotWholePattern.IsMatch(strNumber);
  }

//是否为邮件
  public bool IsEmail(String strNumber)
  {
   Regex objNotWholePattern=new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
   return objNotWholePattern.IsMatch(strNumber);
  }

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

---------------------------------------------------------

抱歉!评论已关闭.