本站首页    管理页面    写新日志    退出

The Neurotic Fishbowl

[.NET-Winform]问题锦集解决方案
麦林 发表于 2007/12/4 17:15:45

增减时间(正负数):DateTime dt = Convert.ToDateTime(Convert.ToString(time)).AddDays(-1); 添加自动增长字段:select * ,identity(int,1,1)as ddd into #mytable from mytable 获取日期部分值:select datename(month,getdate()) 随机值:rtrim(100000+cast(900000*rand(checksum(newid())) as int)) 过滤条件为空查全部:where a.date = case when @date = '' then a.date else @date end OriginalValue:指示发生任何更改前记录中已经存在的 Field 的值。 UnderlyingValue:指示数据库中 Field 对象的当前值。 用于between and 有不同的结果:SELECT replace(replace(replace(2007年10月17日,'年','-'),'月','-'),'日','')  -----> 2007-10-17  (字符串)SELECT Convert(datetime,replace(replace(replace(2007年10月17日,'年','-'),'月','-'),'日','')) -----> 2007-10-17  (时间)   创建数据库            SqlConnection con = new SqlConnection("server = .; uid = sa ; pwd = 密码 ; database = tempdb");            con.Open();            SqlCommand cmd = new SqlCommand("create database mydb", con);            cmd.ExecuteNonQuery();            con.ChangeDatabase("mydb");            cmd = new SqlCommand("create table information(studentid char(10),name char(10),scoure char(10))", con);            cmd.ExecuteNonQuery();            MessageBox.Show("数据库[mydb]建立成功!"); 创建---添加--查询--删除create table #A(amount decimal(6,2), paidamount decimal(6,2), balance decimal(6,2)) insert into #A (amount ,paidamount,balance) select sum(amount)c_amount,sum(paidamount)c_paidamount,sum(balance)c_balance from yhaplist select * from #A drop table #A 添加列--列赋值--不同表不同条件赋值--删除列alter table GwByHCurrentQty add tempcol varchar(128) update GwByHCurrentQty set tempcol = (select gwbymeasureunit.name from yhwlshopproduct left join gwbymeasureunit on gwbymeasureunit.id = yhwlshopproduct.measureunitid where yhwlshopproduct.number = GwByHCurrentQty.num) update  GwByHCurrentQty set quantity = case when (select count from #all where number = GwByHCurrentQty.num and name = GwByHCurrentQty.tempcol) is null then 0 else (select count from #all where number = GwByHCurrentQty.num and name = GwByHCurrentQty.tempcol) end where pihao = (select top 1 pihao from GwByHCurrentQty aa where aa.num = GwByHCurrentQty.num order by pihao desc) ALTER TABLE GwByHCurrentQty DROP column tempcol 报警:  判断 是否一年左右,有没有到期限,有没有在alarm表中 select licenseID from licenseInformation where ('"+today+"' between (benkDate+362) and (benkDate+368)) and (benkDate < limitDate)and licenseInformation.licenseID not in (select LicID from Alarm)        不在,弹出对话框提示,并添加到alarm表中,修改备用时间。 insert into Alarm(LicID,DaTi) values ('" + licID + "','" + DateTime.Now + "') update licenseInformation set benkDate = (benkDate + 365) where licenseID = '" + licID + "'"  处理存在的,判断是否至今天已经超过6天了,若超过就删除  delete from Alarm where (dati+6)< '"+today+"'

阅读全文(2264) | 回复(0) | 编辑 | 精华

 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)
 

The Neurotic Fishbowl

.: 公告

fighting for the work!


Bloginess

«September 2025»
123456
78910111213
14151617181920
21222324252627
282930

.: 我的分类(专题)

首页(449)
文字感悟(103)
学习公共库(61)
生活体会(100)
资源收集(14)
.NET-Winform(27)
音乐文字(15)
心情小记(119)
SQL问题解决(10)


In the Bowl

.: 最新日志

C#打印代码
你看到的我是蓝色的
即将逝去的3月
这个假期
两个月过去
表名存在其他表时获取数据
条码打印
Remoting的用法
INI文件用法


.: 最新回复

回复:条码打印
回复:条码打印
回复:即将逝去的3月
回复:cookie对象使用
回复:条码打印
回复:JSP学习(字符串比较)
回复:应收应付核销规则及常见问题(续)
回复:两个月过去
回复:两个月过去


The Fishkeeper
blog名称:栗色?蓝色?
日志总数:449
评论数量:201
留言数量:37
访问次数:2259485
建立时间:2006年5月16日



Text Me

.: 留言板

签写新留言

链接完成
回:loseVC
来喽~
转转......
新年啦
对自己说
祝福
回:佑手
WO


Other Fish in the Sea

.: 链接


loseVC's BLOG
Collapsar_feel
布衣加针
C#and.Net
Kinogam Web




站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.045 second(s), page refreshed 144772917 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号