摘要: ceil和floor函数在一些业务数据的时候,有时还是很有用的。ceil(n) 取大于等于数值n的最小整数;floor(n)取小于等于数值n的最大整数 阅读全文
posted @ 2013-05-09 08:51 用心玲听 阅读(431) 评论(1) 推荐(0) 编辑
摘要: 项目有一个需求,根据输入的内容模糊查询(一般是带英文字母的查询),例如:数据库表中这列存放的数据都是Iif,无论用当用户输入iif还是IIF(不区分大小写),都能得到查询结果,那么SQL脚本的写法如下:select * from formula where upper(Text) like upper('%iif%')select * from formula where Lower(Text) like Lower('%iif%')select * fromfromula where Lower(Text) like '%iif%'(‘%xxx 阅读全文
posted @ 2013-04-20 10:20 用心玲听 阅读(954) 评论(0) 推荐(0) 编辑
摘要: DECLARE @str varchar(20);DECLARE @dt datetime;set @str='2012'+'-10'+'-10';set @dt=CAST(@str AS datetime);select @dt 阅读全文
posted @ 2012-11-17 10:15 用心玲听 阅读(1217) 评论(0) 推荐(0) 编辑
摘要: js判断文本框不能输入特殊符号在文本框的keypress事件调用下面函数。如 <input disabled="disabled" type="text" id='userNameToEdit' onkeypress="TextValidate()" />如果在文本框中按下特殊字符键,则显示警告信息,并且屏蔽输入。function TextValidate(){ var code; var character; var err_msg = "Text can not contain SPACES 阅读全文
posted @ 2012-11-12 11:24 用心玲听 阅读(2756) 评论(0) 推荐(0) 编辑
摘要: SQLServer时间日期函数详解,SQLServer,时间日期,1. 当前系统日期、时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值 例如:向日期加上2天 select dateadd(day,2,'2004-10-15') --返回:2004-10-17 00:00:00.0003. datediff 返回跨两个指定日期的日期和时间边界数。 select datediff(day,'2004-09-01','2004-09-18') --返回:17 select d 阅读全文
posted @ 2012-09-20 15:08 用心玲听 阅读(143) 评论(0) 推荐(0) 编辑
摘要: //先判断是否存在文件 string path = "d:\\localName.txt"; FileStream fs = new FileStream(path,FileMode.OpenOrCreate); //没有的话则创建,有则打开 StreamReader sread = new StreamReader(fs); string input = sread.ReadLine(); if (input != null) { txtname.Text = input; lbtishi.Visible = false; } sread.Close(); fs.Clos 阅读全文
posted @ 2011-09-29 14:59 用心玲听 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 动态sql就可以解决相关的多表链接查询以及模糊查询的问题 <select id="SelectEemployee" parameterClass="string" resultMap = "MemberMap"> select CardNo,Name from Member <dynamic prepend="WHERE"><isParameterPresent>User_ID = #value#</isParameterPresent></dynamic> 阅读全文
posted @ 2011-09-27 16:28 用心玲听 阅读(422) 评论(0) 推荐(0) 编辑
摘要: public class SQLiteHelper { #region 数据库的连接属性 private static SQLiteConnection scon; public static SQLiteConnection Connect { get { if (scon == null) { string con = "Data Source=e:\\logdb.db;Pooling=true;FailIfMissing=false"; scon = new SQLiteConnection(con); } else if (scon.State == Connect 阅读全文
posted @ 2011-09-05 10:07 用心玲听 阅读(549) 评论(0) 推荐(0) 编辑
摘要: 首先,sqlite数据库在时间处理上和sqlserver还有oracle不同,下面根据自己做过的实例总结一下.创建了一个Log数据表:LogIDSourceIDOperatorIDLogTypeLogLevelLogTimeLogContent1aaa.aspx0212011-08-18 16:44:32.000aaaa2bbb.aspx1222011-08-18 16:38:32.000bbbb3ccc.aspx2332011-09-02cccc4ddd.aspx3142011-08-15dddd5eee.aspx4132011-08-18eee普通的sqlserver的查询语句如下:sel 阅读全文
posted @ 2011-09-02 15:03 用心玲听 阅读(1160) 评论(0) 推荐(0) 编辑
摘要: 在项目开发中,不同的模块的Data层对于连接的数据库方法不同,下面分几种介绍:1:采用asp.net中的EntityFramework框架(Ado数据实体模型)LogDBEntities db = new LogDBEntities();常见的方法:db.SaveChanges();执行完一个操作必须有要加这句LogDBEntities 就是我们所创建的ado数据实体模型,他直接关联的数据库表2:企业库DatabaseFactory.CreateDatabase()方法创建数据库实例Database db = DatabaseFactory.CreateDatabase("Gaoxi 阅读全文
posted @ 2011-09-01 10:04 用心玲听 阅读(414) 评论(0) 推荐(1) 编辑