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 Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

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 How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications May 07, 2024 pm 04:20 PM

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

How to convert deepseek pdf How to convert deepseek pdf Feb 19, 2025 pm 05:24 PM

How to convert deepseek pdf

Can't allow access to camera and microphone in iPhone Can't allow access to camera and microphone in iPhone Apr 23, 2024 am 11:13 AM

Can't allow access to camera and microphone in iPhone

What does dao mean in java What does dao mean in java Apr 21, 2024 am 02:08 AM

What does dao mean in java

What does field mean in java What does field mean in java Apr 25, 2024 pm 10:18 PM

What does field mean in java

How to read the Oracle stored procedure execution plan How to read the Oracle stored procedure execution plan Apr 18, 2024 pm 10:18 PM

How to read the Oracle stored procedure execution plan

How does the Java reflection mechanism modify the behavior of a class? How does the Java reflection mechanism modify the behavior of a class? May 03, 2024 pm 06:15 PM

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

See all articles