摘要: 1.自动绑定列 //定义一个需要访问的数据库的信息 string strCon = "Server=PC-20161029WDCV\\SQL2014;Database=StudentDB;Trusted_Connection=True"; SqlConnection con = new SqlConnection(strCon); //打开数据库连接 con.Open(); string ... 阅读全文
posted @ 2017-12-12 09:14 你的斗志并没有失去 阅读(605) 评论(0) 推荐(0)
摘要: --使用DataSet访问数据 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tas... 阅读全文
posted @ 2017-11-24 17:29 你的斗志并没有失去 阅读(128) 评论(0) 推荐(0)
摘要: --1.查询所有列 select * from Student --2.查询一个表中的指定的列 select 姓名, 总学分 from Student --3.定义列别名 select 姓名 as xm , 总学分 as zxf from Student --4.替换查询结果中的数据 select 姓名, case when 总学分=42 --模糊查询 select * from Stud... 阅读全文
posted @ 2017-11-15 17:31 你的斗志并没有失去 阅读(134) 评论(0) 推荐(0)
摘要: --创建数据库 create database StudentDB --使用数据库 use StudentDB --使用系统数据库 use master --删除数据库 drop database StudentDB ---创建表 create table Student ( 学号 int primary key identity(1000,1), 姓名 varchar(50) not null... 阅读全文
posted @ 2017-11-15 17:25 你的斗志并没有失去 阅读(833) 评论(0) 推荐(0)
摘要: ListBox列表框 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string[ 阅读全文
posted @ 2017-10-24 17:11 你的斗志并没有失去 阅读(95) 评论(0) 推荐(0)
摘要: WinForm基础 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btn_MouseEnter(object sender, EventArgs e) { //创建 阅读全文
posted @ 2017-10-23 16:48 你的斗志并没有失去 阅读(133) 评论(0) 推荐(0)
摘要: 字符串 class Program { static void Main(string[] args) { string str = "欢迎来到新兵锋软件培训.NET世界"; Console.WriteLine(str[0]); Console.WriteLine(str[5]); Console. 阅读全文
posted @ 2017-10-19 17:43 你的斗志并没有失去 阅读(120) 评论(0) 推荐(0)
摘要: 抽象类 当一个类中包含抽象方法时,该类也必须用关键字abstract修饰,那么该类称为抽象类。 //定义抽象类Animalabstract class Animal{//定义抽象方法shout()public abstract void shout();} 接口(基础类库中的接口命名都是以大写字母I 阅读全文
posted @ 2017-10-18 17:26 你的斗志并没有失去 阅读(118) 评论(0) 推荐(0)
摘要: 继承和多态 继承(继承具有传递性) //(父类) class Animal { public string Name { get; set; } public void shout() { Console.WriteLine("动物叫"); } } //(子类) class Dog : Animal 阅读全文
posted @ 2017-10-17 16:34 你的斗志并没有失去 阅读(149) 评论(0) 推荐(0)
摘要: 析构方法 和构造方法相反。 class person { public string Name { get; set; } //析构方法,在对象被销毁时会自动调用 ~person() { Console.WriteLine("资源被回收"); } } class Program { static v 阅读全文
posted @ 2017-10-16 11:54 你的斗志并没有失去 阅读(159) 评论(0) 推荐(0)