摘要:
先看示例代码:// Put the next line into the Declarations section.private System.Data.DataSet dataSet; private void MakeDataTables(){ // Run all of the functions. MakeParentTable(); MakeChildTable(); MakeDataRelation(); BindToDataGrid();} private void MakeParentTable(){ // Create a new DataTable. System.Dat 阅读全文
摘要:
先看一段代码 /// <summary> /// /// </summary> /// <param name="oldName"></param> /// <param name="newName"></param> /// <returns></returns> private bool RenameFilea(string oldName, string newName) { string filepath = System.IO.Directory.G 阅读全文
摘要:
先看一个实例:private Dictionary<string, string> needfirstReplaces = new Dictionary<string, string>() { {"one","onemail"}, {"two","twomail"}, {"three","threemail"}, {"four","fourmail"} };protected virtual Dictionary 阅读全文
摘要:
首先添加:using System.Net.Mail;代码如下,具体自己处理,以符合你的需求: public static bool SendMail(string subject, string body) { bool result = false; try { List<string> toMailList =new List<string>(){ {"sping@sina.com"}, {"springyang@sina.com"} }; if (toMailList.Count > 0) { MailMessage mail = new MailMess 阅读全文
摘要:
string.Concat:参数arg0Object 或 空引用(在 Visual Basic 中为 Nothing)。返回值arg0 的值的 String 表示形式。如 string.Concat("a","b","c","d") 的值是 "abcd",作用是连接字符串.string.SubstringString.Substring (Int32) 从此实例检索子字符串。子字符串从指定的字符位置开始。如:string str = "abcdefg";str = str.Substring(3);str的结果是"efg";因为字符串索引从0开始,3其实是第四个字符.String.Substr 阅读全文
摘要:
代码如下: private string GetHttpStr(string str, string httpStr) { bool Ishavevalue = false; int newlength = httpStr.Length; string newstr = null; string httpendString = "<"; if (str.Length >= newlength && str.Contains(httpStr)) { newstr = str.Substring(str.IndexOf(httpStr, StringCompariso 阅读全文
摘要:
运行如下代码时发现弹出Exception from HRESULT: 0x800A03EC异常 private void ExportExcel(DataTable dt) { if (dt == null) return; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { return; } System.Globalization.CultureInfo CurrentCI = System.Thr 阅读全文
摘要:
fileURL:上传文件的路地址docfile:byte[]类型的字节流private void UploadToLibrary(string fileURL, byte[] docfile) { WebRequest request = WebRequest.Create(fileURL); request.Credentials = System.Net.NetworkCredential(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["UserPassword"], Confi 阅读全文
摘要:
Domain:域名,地址名;folderURL:Domain+文件夹名如下就会在Domain一个文件夹 public bool CreateFolder(string folderURL) { try { WebRequest request = WebRequest.Create(folderURL); request.Credentials = System.Net.NetworkCredential(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["UserPassword"], 阅读全文
摘要:
新建一个类public class FolderBE { public string FolderOne { get; set; } public string FolderTwo { get; set; } public string FolderThree { get; set; } public string FolderFour { get; set; } public string FolderFive { get; set; } }然后 List<FolderBE> listFolder = new List<FolderBE>(); FolderB 阅读全文