The Perfect Day

分享技术,编写未来

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2008年5月26日

摘要: //如果有超过一屏的数据,想通过关键字查找到相关记录,然后再定位之,做法如下://遍历所有行,把某单元格的值和关键字对比,找到后清除所有选择行,然后把当前行设为选择,然后把grid的CurrentCell设置为当前行的某个可见单元格即可,效果就会自动跳到定位好的行上。 string str = textBox1.Text.Trim(); foreach (DataGridViewRow dgvRo... 阅读全文
posted @ 2008-05-26 15:33 StephenJu 阅读(345) 评论(1) 推荐(0) 编辑

摘要: Boolean createdNew; //返回是否赋予了使用线程的互斥体初始所属权 System.Threading.Mutex instance = new System.Threading.Mutex(true, "MutexName", out createdNew); //同步基元变量 if (createdNew) //赋予了线程初始所属权,也就是首次使用互斥体 { Appli... 阅读全文
posted @ 2008-05-26 15:31 StephenJu 阅读(424) 评论(0) 推荐(0) 编辑

摘要: BULK INSERT 数据库名.dbo.[表名] --表名 FROM 'd:\create_report.txt'--文本文件名 WITH ( FIELDTERMINATOR = '|',--字段结束符 ROWTERMINATOR = '|\n'--行结束符 ) 阅读全文
posted @ 2008-05-26 15:30 StephenJu 阅读(249) 评论(0) 推荐(0) 编辑

摘要: 在写类库项目时,经常会有某些特殊业务需要用到服务器端的物理路径,使用传统的System.IO.Directory.GetCurrentDirectory()方法返回的则是WINNT\System32目录,这个一般不能满足正常的业务需求,而要得到具体运行DLL所在的物理目录可以通过Assembly.GetExecutingAssembly().CodeBase属性来取得,具体参考方法如下: priv... 阅读全文
posted @ 2008-05-26 15:28 StephenJu 阅读(2784) 评论(0) 推荐(0) 编辑

摘要: public class PositionData { private string name; //字段 private string ticker;//字段 private string shares;//字段 public PositionData() ... 阅读全文
posted @ 2008-05-26 15:28 StephenJu 阅读(6885) 评论(0) 推荐(0) 编辑

摘要: 假设我们的DataTable有5K左右的数据 那么,我们需要对他进行更加快速的操作 正常我们可能使用DataView.RowFilter来作 如果一两次都无所谓,如果要对DataView的RowFilter/Sort进行大批量的操作--该操作会导致DataTable索引重建.因为RowFilter Sort的设置会 导致DataView索引的建立 那么,是不建议的,应该使用 1.设置DataV... 阅读全文
posted @ 2008-05-26 15:25 StephenJu 阅读(844) 评论(0) 推荐(0) 编辑

摘要: namespace t1 { public abstract class myClass //不能被实例化 { public myClass() //总会被调用,否则无法创建带参构造函数 { MessageBox.Show("基类的无参构造函数!"); } public myClass(int... 阅读全文
posted @ 2008-05-26 15:18 StephenJu 阅读(295) 评论(0) 推荐(0) 编辑

摘要: //*********************************************************// 主要属性: Description:树视图控件上显示的说明文本,如上图中的”选择要进行计算的目录”; RootFolder:获取或设置从其开始浏览的根文件夹,如上图中设置的我的电脑(默认为桌面); SelectedPath:获取或设置用户选定的路径,如... 阅读全文
posted @ 2008-05-26 15:09 StephenJu 阅读(260) 评论(0) 推荐(0) 编辑

摘要: //创建主菜单 private void CreateMenus() { MenuStrip mainMenu = new MenuStrip(); DataSet ds = new DataSet(); string xmlMenuIndo = System.Windows.F... 阅读全文
posted @ 2008-05-26 14:58 StephenJu 阅读(327) 评论(0) 推荐(0) 编辑

摘要: 一、排序 1 获取DataTable的默认视图 2 对视图设置排序表达式 3 用排序后的视图导出的新DataTable替换就DataTable (Asc升序可省略,多列排序用","隔开) DataView dv = dt.DefaultView; dv.Sort = "id Asc,name Desc"; dt = dv.ToTable(); 二、检索 1 设置查询字符串 2 使用Selec... 阅读全文
posted @ 2008-05-26 14:54 StephenJu 阅读(289) 评论(0) 推荐(0) 编辑

摘要: DataRow dr = ds.Tables["student"].NewRow(); dr.ItemArray = ds.Tables["student"].Rows[0].ItemArray; ds.Tables["student"].Rows.Add(dr); //===========================1===============================// ... 阅读全文
posted @ 2008-05-26 14:53 StephenJu 阅读(2744) 评论(0) 推荐(0) 编辑

摘要: void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { DataGridView dgv = (DataGridView)sender; if (e.Control is DataGr... 阅读全文
posted @ 2008-05-26 14:52 StephenJu 阅读(656) 评论(0) 推荐(0) 编辑

摘要: C# 的类型转换,其内容涉及 C# 的装箱/拆箱/别名、数值类型间相互转换、字符的 ASCII 码和 Unicode 码、数值字符串和数值之间的转换、字符串和字符数组/字节数组之间的转换、各种数值类型和字节数组之间的转换、十六进制数输出以及日期型数据的一些转换处理,写在这里以备共同研究。 1. 装箱、拆箱还是别名 许多 C#.NET 的书上都有介绍 int -> Int32 是一个装... 阅读全文
posted @ 2008-05-26 14:50 StephenJu 阅读(386) 评论(0) 推荐(0) 编辑

摘要: 关键字:构造函数;析构函数;垃圾回收器;非托管资源;托管资源 一.构造函数与析构函数的原理 作为比C更先进的语言,C#提供了更好的机制来增强程序的安全性。C#编译器具有严格的类型安全检查功能,它几乎能找出程序中所有的语法问题,这的确帮了程序员的大忙。但是程序通过了编译检查并不表示错误已经不存在了,在“错误”的大家庭里,“语法错误”的地位只能算是冰山一角。级别高的错误通常隐藏得很深,不容... 阅读全文
posted @ 2008-05-26 14:49 StephenJu 阅读(453) 评论(0) 推荐(0) 编辑

摘要: DateTime dt = DateTime.Now; Label1.Text = dt.ToString();//2005-11-5 13:21:25 Label2.Text = dt.ToFileTime().ToString();//127756416859912816 Label3.Text = dt.ToFileTimeUtc().ToString();//12775... 阅读全文
posted @ 2008-05-26 14:47 StephenJu 阅读(267) 评论(0) 推荐(0) 编辑

摘要: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace StephenJu.Second { ... 阅读全文
posted @ 2008-05-26 14:33 StephenJu 阅读(327) 评论(0) 推荐(0) 编辑

摘要: 将Excel导入SQL Server2000 select * into tableName from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source=e:\simple.xls;Extended Properties=Excel 8.0')[sheet1$] select * into tableName from openrowse... 阅读全文
posted @ 2008-05-26 12:44 StephenJu 阅读(228) 评论(0) 推荐(0) 编辑

摘要: 1.比较字符串:Compare、CompareTo、Equals、==、!= 2.定位字符和子串:StartWith/EndsWith、IndexOf/LastIndexOf、IndexOfAny/LastIndexOfAny 3.格式化字符串:Format 4.连接字符串:Concat、Join、+ 5.分裂字符串:Split 6.插入和填充字符串:Insert、PadLeft/PagRight... 阅读全文
posted @ 2008-05-26 12:38 StephenJu 阅读(278) 评论(0) 推荐(0) 编辑

摘要: create proc pr_test @IN_STORE_CODE varchar(11), @in_date_start varchar(8), @in_date_end varchar(8), @state_flag char(1), @WH_CODE varchar(3), @RECIPT_NO char(11), @SUP_NAME varchar(60), @MATERIAL_CO... 阅读全文
posted @ 2008-05-26 12:36 StephenJu 阅读(409) 评论(0) 推荐(0) 编辑

摘要: --查看表的属性 select * from sysObjects where [Name] = 'section' --用法 if exists ( select * from sysObjects where [Name] = 'section' and xtype='U' ) Drop Table table1 go Create table1 ( ) --获取所有用... 阅读全文
posted @ 2008-05-26 12:32 StephenJu 阅读(262) 评论(0) 推荐(0) 编辑