linq 获取数据库时间 或者执行其他带返回值的sql查询
using (LongXingDBDataContext db = new LongXingDBDataContext())
{
DeviceInfo di;
di = new DeviceInfo();
var a = db.ExecuteQuery<DateTime>("select getdate()",new object[] {});
di.CreateDate = a.First();
db.DeviceInfo.InsertOnSubmit(di);
db.SubmitChanges();
this.toolTip1.Show("保存完毕", this, ((Control)sender).Location, 2000);
}
相关文档:
对这个进行优化
select n5001 门店,n5002 部门,n5004 小分类,n5019 商品编码,c01d21 商品名称,
nvl(xse,0)-nvl(dzxs,0) 销售,
mle 毛利,
nvl(xl,0)-nvl(dzsl,0) 销量
from
(select n5001,n5002,n5004,n5019,sum(n5011) xse,sum(n5016) mle,sum(n5023) xl
from n50
where to_char(n5010,'yyyymmdd')>='20 ......
在程序中我们可能经常会遇到这种情况,比如要取一个listbox里面的选择项,得到的结果可能是string ID="id1,id2,id3,id4",然后我们要把这些ID插入到数据库中,同时每个id对应的是要插入一条记录。实现的方法有很多,但是如果我们通过下面这个函数(RecurrentSplit)就能简单的达到 ......
源贴:http://topic.csdn.net/u/20100417/19/ebdc216a-acc9-4e04-80f3-dbada0b4f3fe.html?74846
数据类型:
Code char(6)
CreateTime datetime
Price float
Status bit
数据如下:
Code CreateTime Price Status
031002 2008-10-17 ......
Microsoft SQL Server 2008
安装图解(Windows 7)
FoxDie
2010年04月17日
简介
本文详细记录了一次完整的Microsoft SQL Server 2008在Windows 7操作系统上的安装过程。注意:Microsoft SQL Server 2008与Windows 7操作系统存在一定的兼容性问题,在完成安装之后需要为Microsoft SQL Server 2008安装SP1补丁。下面将详细 ......
从dateTime类型数据中获取季度:
select cast(datepart(q,sign_date) as varchar(2))+'季度'
一.sql server日期时间函数
1. 当前系统日期、时间
select getdate()
2. dateadd 在向指定日期加上一段时间 ......