rs.addnew
添加记录到数据表末端
rs.update
更新数据表记录
SQL
语句的添加、删除、修改虽然有如下很多种方法,但在使用过程中还是不够用,不知
是否有高手把更多灵活的使用方法贡献出来?
添加、删除、修改使用
db.Execute(Sql)
命令执行操作
╔
----------------
╗
☆
数据记录筛选
☆
╚
----------------
╝
注意:单双引号的用法可能有误
(
没有测式
)
Sql = "Select Distinct
字段名
From
数据表
"
Distinct
函数,查询数据库存表内不重复的记录
Sql = "Select Count(*) From
数据表
where
字段名
1>#18:0:0# and
字段名
1< #19:00# "
count
函数
,
查询数库表内有多少条记录,“字段名
1
”
是指同一字段
例:
set rs=conn.execute("select count(id) as idnum from news")
response.write rs("idnum")
sql="select * from
数据表
where
字段名
between
值
1 and
值
2"
Sql="select * from
数据表
where
字段名
between #2003-8-10# and #2003-8-12#"
在日期类数值为
2003-8-10 19:55:08
的字段里查找
2003-8-10
至
2003-8-12
的所有记录,而
不管是几点几分。
select * from tb_name where datetime between #2003-8-10# and #2003-8-12#
字段里面的数据格式为:
2003-8-10 19:55:08
,通过
sql
查出
2003-8-10
至
2003-8-12
的所有
纪录,而不管是几点几分。
Sql="select * from
数据表
where
字段名
=
字段值
order by
字段名
[desc]"
Sql="select * from
数据表
where
字段名
like '%
字段值
%' order by
字段名
[desc]"
模糊查询
Sql="select top 10 * from
数据表
where
字段名
order by
字段名
[desc]"
查找数据库中前
10
记录
Sql="select top n * form
数据表
order by newid()"
随机取出数据库中的若干条记录的方法
评论