摘要: --带有in谓词的子句查询--查询选修了2号课程的学生姓名select 姓名from 学生where 学号 in( select 学号 from 选修 where 课程号='2') 阅读全文
posted @ 2013-04-22 23:49 乡香田甜 阅读(465) 评论(0) 推荐(0) 编辑
摘要: --去除重复的值(distinct)select distinct 学号from 选修--查询满足条件的记录(like(=)及not like(!=或<>))select *from 课程where 课程名 like '计算机%'--确认集合(in(between...and...))select *from 课程where 课程名 in('计算机软件','计算机技术')--空值的查询select *from 学生where 备注 is null--排序(默认是升序,如果要降序则Desc)select *from 学生order by 阅读全文
posted @ 2013-04-22 23:32 乡香田甜 阅读(613) 评论(0) 推荐(0) 编辑
摘要: 数据定义的一般步骤为:建立(修改,删除)数据库->建立(修改,删除)数据表->数据表初始化//定义数据库create database demoDataon(name=demo,filename='D:\DB\demoData.mdf',size=10)//查看数据库sp_helpdb 'demoData'//分离数据库use mastergo sp_detach_db 'demoData'//附加数据库gocreate database demoDataon(filename='D:\DB\demoData.mdf' 阅读全文
posted @ 2013-04-22 00:29 乡香田甜 阅读(936) 评论(0) 推荐(0) 编辑
摘要: UNION 操作符用于合并两个或多个 SELECT 语句的结果集。请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。SQL UNION 语法,SELECT column_name(s) FROM table_name1 UNIONSELECT column_name(s) FROM table_name2注释:默认地,UNION 操作符选取不同的值。如果允许重复的值,请使用 UNION ALL。 SQL UNION ALL 语法SELECT column_name(s) FROM tabl... 阅读全文
posted @ 2013-03-29 20:24 乡香田甜 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 怎么样datatable表中增加一行合计行 阅读全文
posted @ 2013-03-28 17:01 乡香田甜 阅读(2627) 评论(0) 推荐(0) 编辑
摘要: DevExpress:XtraGrid里面的GridControl控件使用总结 阅读全文
posted @ 2013-03-22 15:39 乡香田甜 阅读(1595) 评论(0) 推荐(0) 编辑
摘要: 设置: checkedListBox1.HorizontalScrollbar=true;DevExpress.XtraEditors.CheckedListBoxControl 因为控件属性中一直找不到该属性需要在代代码中手工添加.(这也是我贴出来的原因,呜呜,找这个属性耗了我不少时间) public partial class Form1 : Form { public Form1() { InitializeComponent(); DisplayHScroll(); } //... 阅读全文
posted @ 2013-03-20 15:34 乡香田甜 阅读(1548) 评论(0) 推荐(0) 编辑
摘要: C# 实现简单打印(三)-认识打印控件,创建一个带打印功能的程序 阅读全文
posted @ 2013-03-07 10:02 乡香田甜 阅读(1217) 评论(0) 推荐(0) 编辑
摘要: C# 实现简单打印(二)-打印一个文本文档,打印的内容是多行的 阅读全文
posted @ 2013-03-07 09:28 乡香田甜 阅读(609) 评论(0) 推荐(0) 编辑
摘要: public partial class Form1 : Form { public Form1() { InitializeComponent(); PrintMethod(); } /// <summary> /// 简单打印的三步骤1. 建立PrintDocument对象2. 设置PrintPage打印事件3. 调用Print方法进行打印 /// </summary> public void PrintMethod() ... 阅读全文
posted @ 2013-03-06 09:30 乡香田甜 阅读(529) 评论(0) 推荐(0) 编辑
摘要: ////MainForm.Server private void ShowEventControl(bool refresh) { this.btnMessage.ImageIndex = 1; if (messageControl1.IsDisposed) { messageControl1 = new UI.UControl.MessageControl(); messageControl1.Visible = false; ... 阅读全文
posted @ 2013-03-05 14:58 乡香田甜 阅读(209) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// C#读取不在同一个程序集中的配置文件(代码没验证??) /// </summary> public static string ReportTemplateDirectory { get { string fileName =Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Mobot.TeamFoundation.Client.Win.exe.config"... 阅读全文
posted @ 2013-03-04 09:01 乡香田甜 阅读(613) 评论(0) 推荐(0) 编辑
摘要: 多线程:显示当前程序中所用程序的线程,得到线程的信息 阅读全文
posted @ 2013-03-02 17:29 乡香田甜 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 当要把方法传送给其他方法时,需要使用委托委托和事件委托和事件这两个概念是完全配合的。委托仅仅是函数指针,那就是说,它能够引用函数,通过传递地址的机制完成。委托是一个类,当你对它实例化时,要提供一个引用函数,将其作为它构造函数的参数Event出场了,它封装了委托类型的变量,使得:在类的内部,不管你声明它是public还是protected,它总是private的。在类的外部,注册“+=”和注销“-=”的访问限定符与你在声明事件时使用的访问符相同事件其实没什么不好理解的,声明一个事件不过类似于声明一个进行了封装的委托类型的变量而已事件 :定义:是类在发生其关注的事情时用来提供通知的一种方式步骤:1 阅读全文
posted @ 2013-02-28 09:42 乡香田甜 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 用户管理:登录窗体通过ShowDialog()方法实现切换 阅读全文
posted @ 2013-02-26 14:09 乡香田甜 阅读(483) 评论(0) 推荐(0) 编辑
摘要: 通用功能类:硬件信息控制器(主机名,cpu编号,网卡地址,MAC地址,主硬盘编号,ip地址,获取最大线程数,验证服务IP) 阅读全文
posted @ 2013-02-22 08:52 乡香田甜 阅读(370) 评论(0) 推荐(0) 编辑
摘要: socket编程:简单的TCP客户端 阅读全文
posted @ 2013-02-21 21:01 乡香田甜 阅读(308) 评论(0) 推荐(0) 编辑
摘要: socket编程:简单的TCP服务器 阅读全文
posted @ 2013-02-21 11:49 乡香田甜 阅读(328) 评论(0) 推荐(0) 编辑
摘要: class Program { static void Main(string[] args) { string hostName = Dns.GetHostName(); Console.WriteLine("本电脑的名字为{0}",hostName); IPHostEntry myself = Dns.GetHostByName(hostName); foreach (IPAddress IPAddr in myself.AddressList) ... 阅读全文
posted @ 2013-02-20 10:19 乡香田甜 阅读(301) 评论(0) 推荐(0) 编辑
摘要: private void Yincangtimer_Tick(object sender, EventArgs e)//窗体隐藏事件 { int a =Control.MousePosition.Y;//光标的在屏幕中的 Y 坐标 int b =Control.MousePosition.X;//光标的在屏幕中的 X 坐标 int height =Screen.PrimaryScreen.WorkingArea.Height;//屏幕的高 int width =Screen.PrimaryScreen.WorkingArea.Width;//屏幕的宽 int x =this.Left;//窗体 阅读全文
posted @ 2013-02-19 20:16 乡香田甜 阅读(709) 评论(0) 推荐(0) 编辑
摘要: 数据转换,实现double转换成整型,浮点型,字符串型 /// <summary> /// 数据转换,实现double转换成整型,浮点型,字符串型 /// </summary> class Program { static void Main(string[] args) { double mydouble = 87.45;//原始数据 int myint; float myfloat; string myString; myint = Convert.ToInt32(mydouble); myfloat = Convert.ToSingle(mydouble); my 阅读全文
posted @ 2013-02-19 20:09 乡香田甜 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 注:希望能全部完整输出,而不是逐个输出static void Main(string[] args) { int inPutNumber = int.Parse(Console.ReadLine()); do { string current = ""; int Model = inPutNumber % 8; inPutNumber/= 8; int intTemp = '0' + Model... 阅读全文
posted @ 2013-02-19 20:05 乡香田甜 阅读(322) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string strResult = ""; try { Console.WriteLine("请输入数字A:"); ... 阅读全文
posted @ 2013-02-19 20:02 乡香田甜 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 原理:基类可以定义并实现虚(virtual)方法,派生类可以重写(override)这些方法实例代码:class Shape { // public int X{get;private set; } public int Y{get;private set;} public int Height{get;set;} public int Width{get;set;} // public virtual void Draw() { Console.WriteLine("Performing base class drawing tasks"); } } class Circ 阅读全文
posted @ 2013-02-19 19:54 乡香田甜 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 首先是主窗体部分,即要判断窗体的状态来决定是否显示悬浮窗口。局部成员声明:private FormWindowState fwsPrevious;private frmTopMost myTopMost;主窗体的Load事件:private void frmMain_Load(object sender, System.EventArgs e){// Save window statefwsPrevious = this.WindowState;// Create top most windowmyTopMost = new frmTopMost( this );} 主窗体的SizeChang 阅读全文
posted @ 2013-02-19 19:02 乡香田甜 阅读(696) 评论(0) 推荐(0) 编辑
摘要: 技术:熟练String 类的Format()方法代码: class Program { static void Main(string[] args) { string name; int sex; string age; int height; string xuexing; string star; string favfood; Console.WriteLine("请输入你的姓名... 阅读全文
posted @ 2013-02-19 19:00 乡香田甜 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 技术:字符串的常用处理方法,及do..while代码: /// <summary> /// 演示字符串的常用处理方法,从邮箱地址中提取用户名 /// </summary> class Program { static void Main(string[] args) { string choice=""; do { string EmailName = ""; Console.WriteLine("请输入你邮箱地... 阅读全文
posted @ 2013-02-19 18:58 乡香田甜 阅读(584) 评论(0) 推荐(0) 编辑
摘要: namespace ConsoleDemo{ /// <summary> /// 双层循环实现冒泡排序 /// </summary> class Program { static void Main(string[] args) { SortedNumbers(); } /// <summary> /// 该方法获得需要排序的数组,表调用排序方法进行排序 /// </summary> public static void SortedNumbers() { int numberCount; int[] numbers; Console.Write 阅读全文
posted @ 2013-02-19 18:54 乡香田甜 阅读(902) 评论(0) 推荐(0) 编辑
摘要: 值参数:当利用值向方法传递参数时,编译程序给实参的值做一份拷贝,并且将此拷贝传递给该方法,被调用的方法不会修改内存中实参的值,所以使用值参数时,可以保证实际值是安全的,在调用方法时,如果形式化参数的类型是值参数的话,调用的实参的表达式必须保证是正确的值表达式publicclassClass1{staticvoidswap(intx,inty){inttemp=x;x=y;y=temp;}staticvoidMain(){inti,j;i=1;j=2;swap(i,j);Console.WriteLine("i 及 j的值分别为{0},{1}",i,j);}}输出结果为1,2 阅读全文
posted @ 2013-02-19 18:32 乡香田甜 阅读(281) 评论(0) 推荐(0) 编辑