Posted in Javascript onNovember 23, 2012
//连接SQL
<script language="javascript"> 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 id,name from Category"; rs.open(sql, conn); alert(rs(0));//取出第一个来 rs.close(); rs = null; conn.close(); conn = null; </script>
//连接ACCESS
<script language="javascript"> 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); alert(rs(0))//取出第一个来 conn.close(); conn = null; } </script>
js 连接数据库如何操作数据库中的数据
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@