随笔分类 -  C#

摘要:C# try { var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost/CallCenter2/CallCenter2/Ajax_GridView_Select.php"); httpWebRequest.C 阅读全文
posted @ 2020-07-20 17:33 海乐学习 阅读(2617) 评论(0) 推荐(0) 编辑
摘要:private delegate void CheckVersionNumber_CallBack(string str);//定义一个为委托 用于 检测版本//检测版本private void m_CheckVersionNumber(string strVersionNumber) { try { CheckVe... 阅读全文
posted @ 2019-07-24 16:37 海乐学习 阅读(5877) 评论(0) 推荐(0) 编辑
摘要:DataGridView.AutoGenerateColumns 获取或设置一个值,该值指示是否为数据源中的每一字段自动创建 BoundColumn 对象并在 DataGrid 控件中显示这些对象。 将AutoGenerateColumns 设置为False就不会自动生成列 dataGridView 阅读全文
posted @ 2018-11-30 16:19 海乐学习 阅读(1142) 评论(0) 推荐(0) 编辑
摘要:实现POST网络请求方法 public static string HttpPost(string url,string postDataStr) { string strReturn; //在转换字节时指定编码格式 byte[] byteData = Encoding.UTF8.GetBytes( 阅读全文
posted @ 2018-11-30 11:28 海乐学习 阅读(4094) 评论(0) 推荐(0) 编辑
摘要:strRecordFile="d:\RecordFile\2017\03\09\00020170309113442.wav"; 完整文件名: string strFilePaht=strRecordFile.Substring(strRecordFile.LastIndexOf("\\") + 1, 阅读全文
posted @ 2017-03-09 12:14 海乐学习 阅读(2240) 评论(0) 推荐(1) 编辑
摘要:string strURL = "http://localhost/WinformSubmit.php"; //string param = string.Format("do=login&u={0}&p={1}", username, password); //参数的另一种写法 string st 阅读全文
posted @ 2016-06-20 10:57 海乐学习 阅读(6660) 评论(0) 推荐(0) 编辑
摘要:引用 Newtonsoft.Json.dll //C# 读取JSON Newtonsoft.Json.Linq.JObject jsonStr = Newtonsoft.Json.Linq.JObject.Parse(strResult); this.txtResult.Text = jsonStr 阅读全文
posted @ 2016-06-20 10:49 海乐学习 阅读(1467) 评论(0) 推荐(0) 编辑
摘要:案一:Try...Catch(执行效率不高) private bool IsNumberic(string oText) { try { int var1=Convert.ToInt32 (oText); return true; } catch ... 阅读全文
posted @ 2016-04-04 11:39 海乐学习 阅读(45081) 评论(2) 推荐(0) 编辑
摘要:using System.Runtime.InteropServices;//放wav public partial class frmMain : Form { 系统放 播放音乐 wav mp3 [DllImport("winmm.dll")] public static extern bool PlaySound(string pszSound, int hmo... 阅读全文
posted @ 2016-03-28 10:13 海乐学习 阅读(2964) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; using System.Reflection; namespace DMS { /// /// C#操作Excel类 /// class ExcelOperate... 阅读全文
posted @ 2016-03-26 20:34 海乐学习 阅读(16857) 评论(0) 推荐(1) 编辑
摘要://多表多行多列的情况 foreach (DataTable dt in YourDataset.Tables) //遍历所有的datatable { foreach (DataRow dr in dt.Rows) ///遍历所有的行 foreach (DataColumn dc in dt.Colu... 阅读全文
posted @ 2016-03-26 20:32 海乐学习 阅读(25581) 评论(0) 推荐(0) 编辑
摘要:System.Data.DataSet objSet = new DataSet(); System.Data.DataTable objTable = new DataTable("test"); objTable.Columns.Add("CodeID", typeof(string)); objTable.Columns.Add("FilterCitem ", typeof(stri... 阅读全文
posted @ 2016-03-26 20:31 海乐学习 阅读(4415) 评论(0) 推荐(0) 编辑
摘要:dataGridView1.AutoGenerateColumns = false; 阅读全文
posted @ 2016-03-18 09:48 海乐学习 阅读(2805) 评论(0) 推荐(0) 编辑
摘要:当使用.NET connector 连接MYSQL数据库,检索某些数据的时候,你可能会得到一个错误信息:"Unable to convert MySQL date/time value to System.DateTime"这是因为在日期列中有"0000-00-00"数据值,要修正这个问题,你可以把... 阅读全文
posted @ 2016-01-22 16:31 海乐学习 阅读(1223) 评论(0) 推荐(1) 编辑
摘要:C# 连接 mySQL 出现 GUID 应包含带 4 个短划线的 32 位数 问题在连接字符串中加入Old Guids=true;如:server=localhost;userid=root;password=;database=airsys;Charset=gb2312;Old Guids=tru... 阅读全文
posted @ 2016-01-22 14:16 海乐学习 阅读(2149) 评论(0) 推荐(1) 编辑
摘要:大家知道,DataSet保存的数据是位于服务器内存里面的原数据库的“副本”。所以用DataSet更新数据的过程就是先对“副本”进行更新,然后在将“原本”更新,按照我的理解就是把“原本”覆盖掉。具体到过程,首先是要找到需要更新的行,然后赋新值,最后更新原数据库。要找到需要修改的行,比较方便的做法就是根... 阅读全文
posted @ 2015-11-18 17:40 海乐学习 阅读(2892) 评论(0) 推荐(0) 编辑
摘要:“未能找到类型或命名空间名称XXXX”,以往遇到这种情况第一时间想到就是没有引用需要的dll。 但今天我反复检查了好几次,还是没有解决问题。我注意到除了错误信息,还有几个警告信息“未能解析引用的程序集XXXXXXVersion=1.0.0.0, Culture=neutral, processorA... 阅读全文
posted @ 2014-11-12 15:50 海乐学习 阅读(4451) 评论(0) 推荐(0) 编辑
摘要:如果不想让DataGridView自动生成与数据源对应的列,只需要把属性AutoGenerateColumns设为false即可。需要注意: 在界面设计的属性窗口中是看不到AutoGenerateColumns属性的,需要在代码中设定,比如在窗口的构造函数中设定:dataGridView1.Auto... 阅读全文
posted @ 2014-09-20 21:58 海乐学习 阅读(7161) 评论(0) 推荐(1) 编辑
摘要:偶然用到CSC编译c#程序,出现如下问题:warning CS1668: “LIB 环境变量”中指定的搜索路径“C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib”无效 --“系统找不到指定的路径。 ”网上找了找,看到如下方法,测试下,果然好用。解决方法:找到那个v6.0A目录,创建名为lib的文件夹 阅读全文
posted @ 2013-06-26 15:41 海乐学习 阅读(764) 评论(0) 推荐(0) 编辑
摘要:private frmChannelInfo myChannelInfo = null; private void tsbChannelInfo_Click(object sender, EventArgs e) { if (myChannelInfo != null && myChannelInfo.Created) { myChannelInfo.Focus(); return; } myChannelInfo = new frmChannelInfo(); myChannelInfo.MdiParent = this; myChannelInfo.Show(); } 阅读全文
posted @ 2012-10-23 13:36 海乐学习 阅读(590) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示