从ASP.Net webform中运行的Windows Control连接到数据库 [英] Connecting to Database from Windows Control running in ASP.Net webform

查看:73
本文介绍了从ASP.Net webform中运行的Windows Control连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI all


我正在ASP.Net webform上运行Windows Control。从这个Windows控件我试图连接到数据库来进行一些数据库操作。


现在我从客户端系统连接数据库时遇到问题,客户端系统只有.net框架没有SQL客户端已安装。它在.Net与SQL客户端安装的客户端系统上运行良好


可能是什么问题。我该如何解决这个问题呢?


我相信你会问自己为什么要进行Windows控制!!!我不能使用Windows用户控件,因为我使用Web浏览器控件


提前谢谢。欣赏早期回复


谢谢

EJ

HI all

I am having a windows Control running on ASP.Net webform. From this windows control I am trying to connect to database to do some database operations.

Now I am facing problem while connecting to Database from client systems which is having only .net framework without SQL Client Installed. It works fine on client systems having .Net Installed with SQL Client

What could be the problem. How Can I resolve this problem?

I am sure you will be asking yourself why I am going for Windows control!!!. I could not do it without using windows user control since I am using Webbrowser Control

Thanks in advance. Appreciate early response

Thanks
EJ

推荐答案

你好EJ,


从您的描述中,您在webform页面中使用的winform控件中放置了一些数据操作代码(对于SQLServer)

。并且你发现它在某些带有.net框架和sqlclient的客户端机器上都可以工作,但是没有工作

在其他一些只有.net框架但没有sqlclient的情况下$>
已安装?


我不确定SqlClient是什么?你的意思是?它是System.Data.SqlClient命名空间下的组件吗?如果是这样的话,据我所知,他们是与.net框架一起安装的,并没有单独分发

。或者如果SqlClient是其他的东西,请你提供

一些详细信息吗?此外,当winform

控制不起作用时,它会出现错误消息。以下kb提到使用IEHOST日志进行调试

嵌入IE主机对象


#HOW TO:使用IEHost日志调试Internet上的.NET对象托管

资源管理器
http:// support。 microsoft.com/?id=313892


如果您有任何问题或新发现,请随时在此发布。

问候,


Steven Cheng

微软在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

Hi EJ,

From your description, you put some data manipulation code( for SQLServer)
in a winform control which is used in webform page. And you find it works
on some client machine with both .net framwork and sqlclient , but not work
on some others which only have .net framework but without sqlclient
installed?

I''m not sure what the "SqlClient" do you mean? Is it the components under
the System.Data.SqlClient namespace? If so, as far as I know, they''re
installed together with the .net framework and is not separately
distributed. Or if the SqlClient is other things ,would you please provide
some detailed info on it? Also, it there error message when the winform
control not work. The following kb has mentioned using IEHOST log to debug
embeded IE host objects

#HOW TO: Use the IEHost Log to Debug .NET Object Hosting in Internet
Explorer
http://support.microsoft.com/?id=313892

If you have any questions or new findings, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


HI Steven


哦,你回来了!谢谢


在我之前的帖子中,我正在引用SQL服务器客户端工具


现在我已经找到了,你关于我的应用程序发展。如您所知,使用ASP.Net webform中的webbrowser控件所面临的问题解决了许多问题。在单击文档元素后的同一个webbrowser控件中,我正在尝试将我从Iframe读取的数据保存到运行webapplication的数据库中。


我测试了这个应用程序,它运行如果在运行应用程序的任何地方都安装了带有MDAC 2.7的.Net Framework,那么在Intranet区域和网络服务器上的SQL服务器连接并保存数据并保存数据。


现在当我们正试图在互联网上访问相同的Web应用程序,我们在连接到Web服务器上的数据库时遇到问题。它无法从客户端计算机上运行的webbrowser控件连接到数据库。我们怎样才能解决这个问题


我观察到的另一件事是我能够连接到网络服务器上的数据库,只有服务器名称作为机器名称给出SQL服务器数据库驻留在连接字符串中。如果在连接字符串中给出SQL服务器数据库的IP地址,则无法连接到数据库。



谢谢

E
HI Steven

Oh, You are back! thank

In my previous post, i was refering to SQL server client tool

Now I have found that, you about the application I am developing. As you know you have solved many of our problem using where we faced in usiing webbrowser control in ASP.Net webform. In the same webbrowser control after clicking on document elements, I am trying to save the data I am reading from Iframe to database where our webapplication is running.

I tested this application, it runs fine in intranet zone and connents to SQL server on the web server and saves the data, if .Net Framework with MDAC 2.7 is installed on the system wherever the application is run.

Now when we are trying to access the same webapplication on internet we are facing problem in connecting to Database on the webserver. It is unable to connect to the database from webbrowser control which is running on client machine. How can we reslove this problem

One more thing I observed is I am able to connect to the database which is on the webserver only if the server name is given as the machine name where SQL server Database resides in the connection string. We are unable to connect to the database if the IP address of the SQL server Database is given in the connection String

Hope you can understand my problem. Help me in resolving this critical problem. Eary response is appreciated

Thanks
E


您好EJ,


从您的进一步描述中,问题似乎也可能是由于基于互联网的场景中来自客户端的数据库服务器的

连接。

有时当服务器位于防火墙后面,客户端可能无法连接服务器。这是一篇讨论该问题的kb文章。


#INF:通过防火墙与SQL Server通信所需的TCP端口
http://support.microsoft.com/?id=287932


此外,MDAC是在XP或2k机器上自动安装的,所以一般情况下,这不会是问题。

但我认为你仍然可以执行一些进一步测试是否由于连接到ServerMachine时的问题引起了问题,或者由于客户端上安装了MDAC组件而导致的问题是



谢谢。


问候,


Steven Cheng

Microsoft在线支持

安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

Hi EJ,

From your further description, the problem seems also likely cause by the
connection to the DataBase server from client in internet based scenario.
And sometimes when the Server is behind a firewall, the client may fail to
connect the server. Here is a kb article discussing the problem.

#INF: TCP Ports Needed for Communication to SQL Server Through a Firewall
http://support.microsoft.com/?id=287932

Also, the MDAC is auto intalled on the XP or 2k machine, so generally ,this
won''t be the problem.
But I think you can still perform some further tests to see whether the
problem is caused by the problem on connecting to the ServerMachine or is
due to the MDAC component installed on client.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


这篇关于从ASP.Net webform中运行的Windows Control连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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