Tips

Window

 

protected void Mess(string Mes)
    {
        this.ClientScript.RegisterStartupScript(GetType(), "a""alert('" + Mes + "');"true);
    }

 

VS向SQL中寫入DateTime:

 

SqlParameter[] sqlParaInsert = new SqlParameter[] { 
            new SqlParameter("@empNo", txt_Employee_No.Text.Trim()),
            new SqlParameter("@password",FormsAuthentication.HashPasswordForStoringInConfigFile(LblPassword.Text.Trim(), "md5").ToString()), 
            new SqlParameter("@Hours",DropDownList2.SelectedValue.ToString()),
            new SqlParameter("@flyerID",DropDownList1.SelectedValue.ToString()),
            new SqlParameter("@startTime",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
            new SqlParameter("@endTime",DateTime.Now.AddHours(1).ToString("yyyy-MM-dd HH:mm:ss"))
            };
 
 

 可以向SQL中定义的Int 类型的数据 传入Sting类型的数据,  getdate()自动获得服务器的时间,标识列:SQE

 

string HostName = System.Net.Dns.GetHostName();
string HostName2 = System.Net.Dns.GetHostEntry(Request.UserHostName).HostName;
 Response.Write(HostName);
 Response.Write(HostName2);

 一个字符串在另一个字符串中出现的位置

string r = ADPath.Replace("OU=", "");
int num = (ADPath.Length - r.Length) / 3;

相同字符截取字符串

using System.Text.RegularExpressions;
string str="aaajsbbbjsccc";
string[] sArray=Regex.Split(str,"js",RegexOptions.IgnoreCase);
foreach (string i in sArray) Response.Write(i.ToString() + "<br>");

posted @ 2012-05-31 09:39  hishanghai  阅读(123)  评论(0编辑  收藏  举报