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> ......
dim conn,connstr
Set conn = Server.CreateObject("ADODB.Connection")'创建一个数据库链接对象conn,方便后面调用
connstr="Provider=SQLOLEDB;Data Source=(local);Initial Catalog=111;User ID=sa;Password=1234;" '创建一个数据库的recordset对象,方便以后调用
conn.Open connstr'打开数据库 ......
Access 的 SQL 中,计算相应编号的记录之间 加 减 的查询命令
例如 计算ID为 6 的 合计 减去 ID 为 2、3、4 以及加上 ID 为 5 的合计
SELECT SUM(R) AS 结果
from
(
SELECT 合计 AS R from T1 WHERE (ID = 6) UNION
SELECT -合计 AS R from T1 WHERE (ID = 2) UNION
SELECT -合计 AS R f ......
1.
SQL> desc gjh_a05 ;
Name Type Nullable Default Comments
----- ------------- -------- ------- --------
A0500 VARCHAR2(2) Y &nbs ......
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 ......