set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={mysql};database=yourdatabase;
uid=username;pwd=yourpassword;option=16386;"
9.Visual Foxpro 连接方法:
set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft Visual Foxpro driver};sourcetype=DBC;sourceDB=*.dbc;Exclusive=No;"
10.MS text 连接方法:
set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft text driver(*.txt; *.csv)};dbq=-----;"&_
"extensions=asc,csv,tab,txt;Persist SecurityInfo=false;"
11.MS text OLE DB 连接方法:
set adocon=Server.Createobject("adodb.connection")
adocon.open"Provider=microsof.jet.oledb.4.0;data source=your_path;"&_
"Extended Properties'text;FMT=Delimited'"
<二>常用的四种SQL命令:
1.查询数据记录(Select)
语法:Select 字段串行 From table Where 字段=内容
例子:想从book表中找出作者为"cancer"的所有记录,SQL语句便如下:
select * from book where author=’cancer’
"*"是取出book表所有的字段,如查询的字段值为数字,则其后的"内容"便无须加上单引号,如是日期,则在Access中用(#)包括,而在SQL server中则用(’)包括,
如:
select * from book where id=1
select * from book where pub_date=#2002-1-7# (Access)
select * from book where pub_date=’2002-1-7’ (SQL Server)
提示:
日期函数to_date不是标准sql文,不是所有的数据库适用,所以大家在使用的时候要参考数据库具体语法
另外如果是查询传入的变量,则如下:
strau=request.form("author")
strsql="select * from book where author=’"&strau&"’"
如果查询的是数字,则:
intID=request.form("id")