考试网 >> IT认证 >> Oracle >> Oracle指导 >> ASP连接11种数据库语法总结

ASP连接11种数据库语法总结

发布时间:2006-06-28 09:44     点击:
分页:上一页  1 [2] 3 4  下一页

  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")
分页:上一页  1 [2] 3 4  下一页
版权申明:未经书面授权请勿转载本站信息!!作品版权归所属媒体与作者所有!!
发表评论: 匿名发表 用户名: 查看评论
您将承担一切因您的行为、言论而直接或间接导致的民事或刑事法律责任
留言板管理人员有权保留或删除其管辖留言中的任意内容
本站提醒:不要进行人身攻击。谢谢配合。
在本站搜索相关信息
2003-2005 Ksw123.com All Rights Reserved. - TOP
Copyright © 2006 Ksw123.com. All rights reserved.中国考题网 版权所有