//連接SQL 複製程式碼 程式碼如下: conn.Open("Provider=SQLOLEDB.1; Data Source=tgf; User ID=sa; " <BR> "Password=sasa; Initial Catalog=MyBulletin"); <BR>var rs = new ActiveXObject("ADODB.Recordset"); <BR>var sql="select id,name from Category"; <BR>rs.open(sql, conn); <BR>alert(rs(0));//取出第一個來<BR>rs.close(); <BR>rs = null; <BR>conn.close(); <BR>conn = null; <BR> //連接ACCESS 複製程式碼複製程式碼 複製程式碼 程式碼如下: <BR>function conn(){ <BR>var db_bbs <BR>db_bbs="dd.mdb"//定義資料庫<BR>var conn = new ActiveXX ("ADODB.Connection"); <BR>conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" db_bbs ""); <BR>var rs = new ActiveXObject("ADODB.Recordset") ; <BR>var sql="select name from authors"; //資料庫中有authors表,name欄位 rs.open(sql,conn); alert(rs(0))//取出第一個來conn.close(); conn = null; }