日期:2014-05-16 浏览次数:20491 次
if (!Conn) {
var connstr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("/") + "\\liuhe\\liuhe3\\dll\\#fs33afsafsad.mdb";
try{
Conn = new ActiveXObject("ADODB.Connection");
Conn.Open(connstr);
} catch (e) {
Response.Write("数据库连接出错,请检查连接字串。"+connstr);
Response.End;
}}
var conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=SQLOLEDB.1; Data Source=tgf; User ID=sa; "
+"Password=sasa; Initial Catalog=MyBulletin");
var rs = new ActiveXObject("ADODB.Recordset");
var sql="select * from table";
rs.open(sql, conn);
rs.close();
rs = null;
conn.close();
conn = null;
con.Open("DBQ="+你的access文件路径+";DRIVER={Microsoft Access Driver (*.mdb)};");
function conn(){
var db_bbs
db_bbs="dd.mdb"//定义数据库
var conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+db_bbs+"");
var rs = new ActiveXObject("ADODB.Recordset");
var sql="select name from authors"; //数据库中有authors表,name字段
rs.open(sql,conn);
conn.close();
conn = null;