Excel-Add-In connecting to database server

0

I'm developing an Excel-Add-In in Visual Studio 2015. I created a project called MissingPartEvaluation. This project itself is consisting of two projects 1.MissingPartEvalution and 2.MissingPartEvaluationWeb. The first project just has a manifest file that has a SourceLocation defined. The SourceLocation is a link to an IIS-Server. The content of the second project is copied to the IIS - Server.

To start my application, I click on the Start Button in Visual Studio. Then, an Excel with a browser on the right side appears. This browser show the html file MissingPartSummary.html which i have developed in the second project. This html site contains a button. I can test my application clicking on the button in the browser.

In the second project I'm going to establish connection to a SQL Server by using ActiveXObject.

var connection = new ActiveXObject("ADODB.Connection");

Unfortunately, it fails because of following error message.

Error: Error: Automation server can't create object.

The other approach with XMLHttpRequest is the following:

var url = "https://wosevvt227/ajaxReq/php/getData.php";
var xhr = new XMLHttpRequest();

xhr.open('GET', url, true);
xhr.responseType = 'json';
//xhr.setRequestHeader("Authorization", "Basic ***********==");
xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
xhr.withCredentials = true;
xhr.onload = function () {
   var status = xhr.status;
   console.log("Status: " + status);
   if (status === 200) {
       console.log("All ok");
   } else {
       console.log("Houston, we have a problem");
   }

   var response = xhr.responseText;
   console.log("Response: " + response);
 };
 xhr.send();

It fails because of the following error.

SCRIPT7002: XMLHttpRequest: Network error 0x80070005, Access denied MissingPartSummary.html

How can I solve these problems?

javascript
sql
excel
xmlhttprequest
activexobject
asked on Stack Overflow Jul 13, 2018 by user2969510 • edited Jul 13, 2018 by Capricorn

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0