查增删改
select * from Picter 查询表中的所有数据
insert Picter(PicName,PicBriy) values('测试','测试') 向表中添加数据 ID是主键不可以添加
delete Picter where PicNo=1 很据ID查询表中的数据
update Picter set PicName='ceshi' where ID=1 根据ID更新表中的数据
delete from Picter 清空表中的数据
程序里变量(拼SQL语句的形式)
select * from Picter where PicName='" +变量+ "' 查询表中一行数据 可通过 DataSet 取出


string select = "select * from Picter where picname='" + address + "'"; MySqlDataAdapter = new SqlDataAdapter(select, conn); MyDataSet = new DataSet(); MySqlDataAdapter.Fill(MyDataSet); byte[] Mybyte =(byte[])MyDataSet.Tables[0].Rows[0][2]);
select PicBriy from Picter where PicName='测试' 查询表中指定的列名的数据 可通过 comm.ExecuteScalar();取出


string select = "select PicBriy from Picter where Picname ='" + 测试+ "'"; comm = new SqlCommand(select, conn); byte[] Mybyte = (byte[])comm.ExecuteScalar();
update Picter set PicName='ceshi' where ID=‘"+变量+"’ 更新表中的数据
法则运算
select COUNT(PicNo) from Picter 总数
select SUM(PicNo) from Picter 和
select MAX(PicNo) from Picter 最大值
select MIN(PicNo) from Picter 最小值
select COUNT( distinct PicName) as num from Picter 查询无重复的总数 as num设置列名 可通过SqlDataReader取出


SqlDataReader MyData = comm.ExecuteReader(); MyData.Read(); string num= MyData["num"].ToString();