1、文本字段的为空的不同: A中的语句可以是:where Field=' ' 或者 where Field is null都可以成立。 S数据库类型是char,却有些不同:where Field=null或where len(Field)=0 2、时间字段的默认值不同: A 中的默认值:Now() S数据库默认值:GetDate() 3、时间字段的比较不同: 以datediff函数为例。 A中的语句可以是:where DateDiff('d',Field,Now())=1 ''这是检索时间为今天的记录。 S中的语句必须是:where DateDiff(dd,Field,Now())=1 4、时间变量插入不同: 经常遇到时间赋于一个变量,然后在于变量插入到数据库! recordset数据集写入数据库,没有任何区别,但是对于insert into语句就不同 变量:datea,dateb都是从表单接收到的时间类型,经过Cdate转化的变量! A中的语句:conn.execute("insert into table(datea,dateb) values(#"&datea&"#,#"&dateb&"#)") S中的语句:conn.execute("insert into table(datea,dateb) values("&datea&","&dateb&")") 其中#号可以是半角引号。变成字符了,呵呵不信试试! 5、备注类型为空判断:(2007-6-15) 用ASP写代码时,经常需要判断字段是否为空,最特殊的字段备注型判断为空,在SQL与ACCess不同! S语句直接:if rs("Content")="" then A语句需要:if isnull(rs("Content")) then
|