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);
}
相关文档:
declare @XML XML
SET @XML='<root>
<OLDVALUE>
<H_Action id="1130">030</H_Action>
<D_Action>030</D_Action>
<OrderCompany>00220</OrderCompany>
<OrderNumber>10004035</OrderNumber> ......
order by 的数值型灵活使用
select * from table_a where id=p_id order by decode(函数,'asc',1,'desc',-1)*jsny;
控制试图的访问时间:
6.create view ...
as
select ... from where exists(select x from dual where sysdate>=8:00am and sysdate<=5:00pm)
妙用decode实现排序
select * from tabnam ......
采用预编译语句集,它内置了处理SQL注入的能力,只要使用它的setString方法传值即可:
String sql= "select * from users where username=? and password=?;
PreparedStatement preState = conn.prepare ......
从dateTime类型数据中获取季度:
select cast(datepart(q,sign_date) as varchar(2))+'季度'
一.sql server日期时间函数
1. 当前系统日期、时间
select getdate()
2. dateadd 在向指定日期加上一段时间 ......