将连接字符串传递给activeX时出错 [英] Error when passing connection string to activeX

查看:90
本文介绍了将连接字符串传递给activeX时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello all



我在我的网页应用程序中使用ActiveX在一个页面中,它在我的PC上正常工作,我从网络传递连接字符串其中包含activex的页面如下:



这是页面中将连接字符串传递给activex的javascript代码:



 <   script     language   =  javascript   类型  =   text / javascript >  
function Connect(){
var doc = document .forms [ <温泉n class =code-digit> 0 ];

var PrinterControl = document .applets(' PrinterObject1');
PrinterControl.UserText = document .form1.hdnConString.value + ' ,' + document .form1.hdnCategory.value + ' < span class =code-string>,' + document .form1.hdnLoginID.value + ' ,' + document .form1.hdnPassword.value + ' ,' + document .form1.hdnCategoryType.value;

}
< / script >

< < span class =code-leadattribute> body önload = Connect() >
< 表格 id = form1 runat = server >




< / form >
< / body >





,在activeX代码中,我收到连接字符串和其他值如下:



  public   String  UserText 
{
get
{
return conString;
}
set
{
conString = value ;

string [] arrID = conString.Split(' );
conStr = Convert.ToString(arrID [ 0 ]);
category = Convert.ToString(arrID [ 1 ]);
loginID = Convert.ToString(arrID [ 2 ]);
password = Convert.ToString(arrID [ 3 ]);
categoryType = Convert.ToString(arrID [ 4 ]);
}
}





每件东西都在我的电脑上正常工作,但是当我安装这个应用程序在客户的服务器,使用activex生成错误的页面,虽然它在我的电脑上工作,我在我公司的其他电脑上通过网络测试它仍然正常工作,客户使用Windows2008与sql server 2012.



以下是在页面中使用activex生成的错误消息,当页面尝试加载activex时:





建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供者:命名管道提供者,错误:40 =无法打开与SQL Server的连接)





请帮忙



谢谢

解决方案

正如错误消息所示,问题可能与您的代码无关:这是一个SQL Sever配置问题(和 Google是你的朋友 [ ^ ])。

Hello all

I am using ActiveX in my web application in one page, it is working properly in my PC, i am passing the connection string from the web page that has the activex in it as following:

This is the javascript code in the page that passing the connection string to the activex:

<script language="javascript" type="text/javascript">
      function Connect() {
          var doc = document.forms[0];

          var PrinterControl = document.applets('PrinterObject1');
          PrinterControl.UserText = document.form1.hdnConString.value + ',' + document.form1.hdnCategory.value + ',' + document.form1.hdnLoginID.value + ',' + document.form1.hdnPassword.value + ',' + document.form1.hdnCategoryType.value;

      }          
      </script>

<body  önload="Connect()">
    <form id="form1"  runat="server" >
.
.
.
.
</form>
</body>



and in the activeX code i receive the connection string and other values as following:

public String UserText
       {
           get
           {
               return conString;
           }
           set
           {
                conString = value;

                string[] arrID = conString.Split(',');
                conStr = Convert.ToString(arrID[0]);
                category = Convert.ToString(arrID[1]);
                loginID = Convert.ToString(arrID[2]);
                password = Convert.ToString(arrID[3]);
                categoryType = Convert.ToString(arrID[4]);
           }
       }



Every thing working properly in my pc, but when i install this application in customer''s server, the page that using activex generating error although it is working in my pc and i tested it in other pcs in my company over network still working ok, the customer using Windows2008 with sql server 2012.

The following is the error message generating in the page that using activex, when the page trying to load activex:


A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 = could not open a connection to SQL Server)


Please help

Thank you

解决方案

As the error message suggests, the problem is probably not related to your code: it is a SQL Sever configuration issue (and Google is your friend[^]).


这篇关于将连接字符串传递给activeX时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆