C# 解析json Newtonsoft.Json
摘要:Newtonsoft.Json.dll public class ErrorInfo { public error_response error_response { get; set; } } public class error_response { public string code { g
阅读全文
posted @
2016-05-10 16:49
苏上话
阅读(680)
推荐(0)
AjaxPro.2.dll使用方法简介
摘要:1、添加对 AjaxPro.2.dll 的引用 2、在 webconfig 中 system.web 节点下 进行如下配置 3、注册类方法 4、前台直接调用 demo 示例
阅读全文
posted @
2016-04-18 17:15
苏上话
阅读(231)
推荐(0)
DataTable 对象 转换为Json 字符串
摘要:/// /// DataTable 对象 转换为Json 字符串 /// /// /// public static string ToJson(this DataTable dt) { JavaScriptSerializer javaScriptSerializ...
阅读全文
posted @
2016-04-06 10:15
苏上话
阅读(162)
推荐(0)
C# window 窗体 保持最前显示
摘要:两句话搞定[DllImport("user32.dll", CharSet = CharSet.Auto)]private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width...
阅读全文
posted @
2016-01-11 17:51
苏上话
阅读(7210)
推荐(0)
C# 读取EXCEL数据
摘要:/// /// 读取EXCEL数据 /// /// /// public static System.Data.DataSet ExcelToDS(string Path) { s...
阅读全文
posted @
2016-01-11 17:49
苏上话
阅读(2933)
推荐(0)
C# 获取计算机 信息
摘要:/// /// 获取本机 机器名 /// /// public static string GetMachineName() { ...
阅读全文
posted @
2016-01-11 17:48
苏上话
阅读(2207)
推荐(0)
C# 调用浏览器打开网址
摘要:private void button1_Click(object sender, EventArgs e) { //调用系统默认的浏览器 System.Diagnostics.Process.Start(http://www.baidu...
阅读全文
posted @
2016-01-11 17:46
苏上话
阅读(1796)
推荐(0)
C# winform 窗体弹出选择目录或文件 的对话框
摘要://弹出一个选择目录的对话框privatevoid btnSelectPath_Click(object sender, EventArgs e) //弹出一个选择目录的对话框 { FolderBrowserDialog path = new FolderBrowserDialog(); ...
阅读全文
posted @
2016-01-11 17:44
苏上话
阅读(27390)
推荐(1)
C# winform 窗体 彻底退出窗体的方法
摘要:1.this.Close(); 只是关闭当前窗口,若不是主窗体的话,是无法退出程序的,另外若有托管线程(非主线程),也无法干净地退出; 2.Application.Exit(); 强制所有消息中止,退出所有的窗体,但是若有托管线程(非主线程),也无法干净地退出; 3.Application.Exit
阅读全文
posted @
2016-01-11 17:43
苏上话
阅读(3733)
推荐(0)
C# txt文件读写
摘要://读取文件内容(1).使用FileStream类进行文件的读取,并将它转换成char数组,然后输出。byte[] byData = new byte[100]; char[] charData = new char[1000]; public void Read() ...
阅读全文
posted @
2016-01-11 17:39
苏上话
阅读(289)
推荐(0)
C# post请求 HttpWebRequest
摘要:1.参数 paramsValue的格式 要和 Reques.ContentType一致, 如果 contentype "application/x-www-form-urlencoded" 表单类型,那么 参数为 a=1&b=2 形式 如果 。。。 "application/json" json 类
阅读全文
posted @
2016-01-11 17:32
苏上话
阅读(6935)
推荐(0)
C# 获取当前路径
摘要:public static string AssemblyDirectory { get { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase);
阅读全文
posted @
2016-01-11 17:30
苏上话
阅读(204)
推荐(0)
把EXCEL列号数字变成字母
摘要:把Excel 列号数字变成字母 private static string ToName(int index) { if (index chars = new List(); do { ...
阅读全文
posted @
2014-11-07 10:18
苏上话
阅读(1918)
推荐(0)
C# 导出Excel Aspose.Cells
摘要:public void ExportExcel() { Workbook workbook = new Workbook(); //工作簿 workbook.Worksheets.Clear(); workbook.Worksheets.Add("New Worksheet1");//New Work...
阅读全文
posted @
2014-10-31 16:29
苏上话
阅读(851)
推荐(0)
C# String 与 byte 互转
摘要:String转换为byte数组用byte[] arr = System.Text.Encoding.Default.GetBytes("abcde")byte数组转换为String用:string str = System.Text.Encoding.Default.GetString(arr);
阅读全文
posted @
2014-10-29 11:36
苏上话
阅读(223)
推荐(0)
LINQ之Min
摘要:Min说明:返回集合中元素的最小值;不延迟。生成SQL语句为:SELECT MIN(…) FROM1.简单形式:查找任意产品的最低单价:var q = db.Products.Select(p => p.UnitPrice).Min();2.映射形式:查找任意订单的最低运费:var q = db.O...
阅读全文
posted @
2014-10-23 13:24
苏上话
阅读(1476)
推荐(0)
sqlCacheDependency 更新缓存Cache
摘要:第一步 修改web,config <!--定义数据库连接--> <connectionStrings> <add name="NorthwindConnectionString" connectionString="Server=USERRYRDB;Database=Northwind;UID=sa
阅读全文
posted @
2013-12-06 20:17
苏上话
阅读(423)
推荐(0)