JavaScript calls SQL Server data in the browser

Source: Internet
Author: User

Create a new Web page locally, and then write JavaScript code, you can directly manipulate SQL Server database, is not the cock burst!

Prerequisites must be used in IE.

The following code is tested in WINDOWS10 + IE 11 environment.

<!DOCTYPE HTML><HTML><Head>    <title></title></Head><Body><Scripttype= "Text/javascript">    varOBJdbConn= NewActiveXObject ("ADODB. Connection"); varstrDSN= "Provider=SQLOLEDB.1; Password=password; Persist Security info=true; User id=sa;initial catalog=master;data Source=localhost\\sql"; //need to modify your server address, username, passwordObjdbconn.open (STRDSN); document.write ("Update Data Success!<br>"); Objdbconn.close (); </Script></Body></HTML>

If the update data displayed on the Web page is successful, the connection is successful, if the connection is unsuccessful, look at the developer tools, if the show SQL Server does not exist or deny, this option is available, if there is a magical Automation server can not create objects, very helpless, Attempts to modify the registry, set the security level of IE, adjust ActiveX settings and other options are not resolved.

My win10 and IE are the latest versions.

Win10 was also 371, and was tested successfully on a 309 version.

JavaScript calls SQL Server data in the browser

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.