使用DOTNET构造函数在PHP中创建SqlConnection? [英] Using DOTNET constructor to create SqlConnection in PHP?

查看:118
本文介绍了使用DOTNET构造函数在PHP中创建SqlConnection?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到我们可以使用DOTNET构造函数在PHP中创建一些(我认为只有一些).net对象:

I have learnt that we can create some (I think only some) .net objects in PHP using DOTNET constructor like this:

$dotNETobj = new DOTNET("assembly full name", "classname");


我玩过它,创建了一些.NET对象,如Hashtable,Stack ...,然后尝试使用SqlConnection,但失败了,也许是我做错了.您能否告诉我是否可以用PHP创建该对象?如果可能的话,您可以在此处发布一些代码吗?
这是我的尝试:


I have played with it creating some .NET object like Hashtable, Stack... and I tried with SqlConnection but it failed, maybe I made something wrong. Could you please tell me if it is possible to create that object in PHP? If possible, could you post some code here for that?
Here is my try:

$sqlcon = new DOTNET("System.Data", "SqlConnection");


错误消息太长,我将仅在其中发布一些我认为很重要的消息:


The error message is too long, I''ll post only some of it that I think it is important here:

"...''Failed to instantiate .Net object... The system cannot find the specified.  '' in myurl Stack trace:..."

所有人都排成一行,没有任何中断.我不明白为什么PHP会给我们这样难以理解的错误消息?对于任何新手,也许对于许多中级程序员来说,它都太复杂了,我敢肯定地说.幸运的是,点网不一样!
您的帮助将不胜感激!
谢谢!

All are in a line without any break. I can''t understand why PHP can give us such an illegible error message? It is too complicate to any newbie and maybe many intermediate programmers, I''m sure to say that. Fortunately, dot net is not the same!
Your help would be appreciated!
Thank you!

推荐答案

dotNETobj = DOTNET( 程序集全名" );
dotNETobj = new DOTNET("assembly full name", "classname");


我玩过它,创建了一些.NET对象,如Hashtable,Stack ...,然后尝试使用SqlConnection,但失败了,也许是我做错了.您能否告诉我是否可以用PHP创建该对象?如果可能的话,您可以在此处发布一些代码吗?
这是我的尝试:


I have played with it creating some .NET object like Hashtable, Stack... and I tried with SqlConnection but it failed, maybe I made something wrong. Could you please tell me if it is possible to create that object in PHP? If possible, could you post some code here for that?
Here is my try:


sqlcon = DOTNET(" " SqlConnection");
sqlcon = new DOTNET("System.Data", "SqlConnection");


错误消息太长,我只在其中发布一些我认为很重要的消息:


The error message is too long, I''ll post only some of it that I think it is important here:

"...''Failed to instantiate .Net object... The system cannot find the specified.  '' in myurl Stack trace:..."

所有人都排成一行,没有任何中断.我不明白为什么PHP会给我们这样难以理解的错误消息?对于任何新手,也许对于许多中级程序员来说,它都太复杂了,我敢肯定地说.幸运的是,点网不一样!
您的帮助将不胜感激!
谢谢!

All are in a line without any break. I can''t understand why PHP can give us such an illegible error message? It is too complicate to any newbie and maybe many intermediate programmers, I''m sure to say that. Fortunately, dot net is not the same!
Your help would be appreciated!
Thank you!


我不使用PHP,但这是黑暗中的镜头,可能只是您的问题...

SqlConnection类驻留在名称空间System.Data.SqlClient中.也许在调用DOTNET时需要指定.例如,您可以尝试以下方法之一:
I don''t use PHP, but here''s a shot in the dark that might just be your issue...

The SqlConnection class resides in the namespace System.Data.SqlClient. Perhaps you need to specify that when you call DOTNET. For example, you might try some of these:


这篇关于使用DOTNET构造函数在PHP中创建SqlConnection?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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