Home
Web Front-end
JS Tutorial
Example of JS method to connect SQL database and ACCESS database_javascript skills



Example of JS method to connect SQL database and ACCESS database_javascript skills
May 16, 2016 pm 05:13 PM
access
js
sql
Copy code The code is as follows:
//Connect 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));//Take out the first one
rs.close();
rs = null;
conn.close();
conn = null;
</script>
Copy code The code is as follows:
//Connect ACCESS
<script language="javascript">
function conn(){
var db_bbs
db_bbs="dd.mdb"//Define database
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"; //There is an authors table in the database, and the name field is
rs.open(sql,conn);
alert(rs(0))//Take out the first one
conn.close();
conn = null;
}
</script>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What is the difference between HQL and SQL in Hibernate framework?

How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications

Can't allow access to camera and microphone in iPhone

How to read the Oracle stored procedure execution plan

How does the Java reflection mechanism modify the behavior of a class?
