to_da..." />
 手机
当前位置:查字典教程网 >编程开发 >C#教程 >c#中oracle的to_date函数使用方法
c#中oracle的to_date函数使用方法
摘要:例子一,获取三小时前的记录publicstaticDataTableQuery(){conststringsSql="selectxh,ls...

例子一,获取三小时前的记录

public static DataTable Query() { const string sSql = "select xh,lsh,name from table where gxsj>to_date(:gxsj,'yyyy-MM-dd HH24:mi:ss')"; OracleParameter[] parameters = {new OracleParameter(":gxsj", OracleType.VarChar, 10)}; parameters[0].Value = DateTime.Now.AddHours(-3).ToString("yyyy-MM-dd HH") + ":00:00"; return DBUtility.DbHelperOra.Query(sSql, parameters).Tables[0]; }

例子二,获取大于当前时间的记录

public static string GetHphm(string sClsbdh) { const string sSql = "select name from table where sj>to_date(:yxsj,'yyyy-MM-dd')"; OracleParameter[] paramters = {new OracleParameter("sj", OracleType.VarChar, 10)}; paramters[0].Value = DateTime.Now.ToString("yyyy-MM-dd"); using (var mReader = DbHelperOra.ExecuteReader(sSql, paramters)) { if (mReader.Read()) { return mReader["name"].ToString(); } } return ""; }

【c#中oracle的to_date函数使用方法】相关文章:

c#之利用API函数实现动画窗体的方法详解

C#中时间的几种格式转换方法

C# SendKeys使用方法介绍

C#中如何执行存储过程方法

遍历Hashtable 的几种方法

c#中分割字符串的几种方法

C#注释的一些使用方法浅谈

c#解压文件的实例方法

VB.NET中Caching的使用方法

C#连接Oracle数据库的实例方法

精品推荐
分类导航