摘要:有2张表,结构如下:表province结构:province_id province_name ( primary key:province_id)表city结构:city_id,city_name,province_id (primary key:city_id,province_id) SqlConnection conn = new SqlConnecti...
阅读全文
11 2006 档案
摘要:private void btnBold_Click(object sender, EventArgs e) { Font oldfont, newfont; oldfont = this.richTextBox1.SelectionFont;//获取选定字的字体格式 if (oldfont.Bold) ...
阅读全文
摘要://方法1 private void btnQuery_DayOfWeek_Click(object sender, EventArgs e) { MessageBox.Show("今天是:"+"日一二三四五六".Substring((int)DateTime.Now.DayOfWeek,1); } //方法2 //必...
阅读全文
摘要://KeyPress事件:当控件获得焦点,并且用户按下且释放键盘上的键后发生 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)//文本框只接受数字的输入和小数点 { //IsNumber:指定字符串中位于指定位置的字符是否属于数字类别 //I...
阅读全文
摘要://在DataGridView中显示行号,需要要处理DataGridView的RowPostPaint事件: private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { SolidBrush B = new SolidB...
阅读全文
摘要:-创建数据库if exists(select * from sysdatabases where name=N'master..test')drop database testcreate database test--创建存储过程(法1)if exists(select * from sysobjects where name=N'proc_name' and type='p')drop pro...
阅读全文
摘要:scope_indentity() 返回插入到同一作用域中(存储过程,.......)的indentity列内的最后一个indentity值例: declare @dt table( _id int identity(1,1), _name char(10))insert into @dt (_name) values('zhang')insert into @dt (_name) value...
阅读全文
摘要:注:This method gets the record count much faster than select count(*) from table_name1、一般情况下,可以通过聚合函数Count实现查询出记录的总数 select count(*) as 记录总数 from table_name2、也可以通过查询系统表sysindexes实现 select row...
阅读全文
摘要:ROUND函数是四舍五入函数,返回数字表达式并四舍五入为指定的长度或精度。 语法:ROUND ( numeric_expression , length [ , function ] ) 参数:numeric_expression 精确数字或近似数字数据类型类别的表达式(bit 数据类型除外)。 length 是 numeric_expression 将要四舍五入的精度。length 必须是 t...
阅读全文
摘要:若b列的值都为1则返回Y,否则返回X declare @t table(a int,b int)insert @tselect 1,1 union all select 2,1 union all select 3,1 union all select 4,0 select b=case when exists(select b from @t where b1) then 'X' else 'Y...
阅读全文
摘要:重载:(2必须1可以) 方法名必须相同 参数列表必须不相同 返回类型可以不相同 覆写:(3相同) 方法名必须相同 ...
阅读全文