随笔分类 - SQL Server 数据库
摘要:https://www.cnblogs.com/hqjy/p/4083994.html --建库建表create database student;use student;create table student( sname varchar(10) not null, sno int not nu
阅读全文
摘要:select 学号,姓名,性别,出生日期,Student.班级ID,班级名称 from Student join Class on Student.班级ID = Class.班级ID where 姓名 like '%张%'
阅读全文
摘要:private void btnlogin_Click(object sender, EventArgs e) { //登录按钮事件 try { //判断最后登录时间 是不是今天 string s5 = "select ...
阅读全文
摘要:新建一个winfrom窗体应用程序,为程序添加配置文件App.config,然后在配置文件中添加数据库连接字符串 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Configuration; using System.D...
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System....
阅读全文
摘要://获取用户输入的用户名和密码 string userName=txtuserName.Text.Trim(); string pwd=txtPwd.Text.Trim(); //设置数据库连接 string strCon = "Server=PC-20161029WDCV\\SQL2014;Database=StudentDB;Trusted_Connection=True"; ...
阅读全文
摘要://定义一个需要访问的数据库的信息 string strCon = "Server=PC-20161029WDCV\\SQL2014;Database=StudentDB;Trusted_Connection=True"; SqlConnection con = new SqlConnection(strCon); con.open(); //把sql语句换成删除和更新,即可实现删除和更新操...
阅读全文
摘要:1.自动绑定列 //定义一个需要访问的数据库的信息 string strCon = "Server=PC-20161029WDCV\\SQL2014;Database=StudentDB;Trusted_Connection=True"; SqlConnection con = new SqlConnection(strCon); //打开数据库连接 con.Open(); string ...
阅读全文
摘要:--使用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...
阅读全文
摘要:--1.查询所有列 select * from Student --2.查询一个表中的指定的列 select 姓名, 总学分 from Student --3.定义列别名 select 姓名 as xm , 总学分 as zxf from Student --4.替换查询结果中的数据 select 姓名, case when 总学分=42 --模糊查询 select * from Stud...
阅读全文
摘要:--创建数据库 create database StudentDB --使用数据库 use StudentDB --使用系统数据库 use master --删除数据库 drop database StudentDB ---创建表 create table Student ( 学号 int primary key identity(1000,1), 姓名 varchar(50) not null...
阅读全文