"ADSDSOObject"失败,没有可用的错误消息 [英] 'ADSDSOObject' failed with no error message available

查看:382
本文介绍了"ADSDSOObject"失败,没有可用的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我试图执行下面的代码,我抛出异常''ADSDSOObject"失败,没有错误消息".

在google之后,我发现了这个 http://support.microsoft.com/kb/890307 [

Hi All,

Am trying to execute the code below ,i throws exception "''ADSDSOObject'' failed with no error message available".

after google a lot i found this http://support.microsoft.com/kb/890307[^]

but still not able to understand the correct problem.i use to connect my AD and retrieve values from other code.

Here is the code below

using System;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;

class Program
{
	static void Main(string[] args)
	{
		DataTable users = GetEnabledUsers();

		using (SqlConnection cnx = new SqlConnection("Your Connection String"))
		{
			cnx.Open();
			using (SqlCommand cmd = cnx.CreateCommand())
			{
				foreach (DataRow user in users.Rows)
				{
					if (user["otherPager"] != DBNull.Value && !String.IsNullOrEmpty((string)user["otherPager"]))
					{
						if (user["mail"] != DBNull.Value &%3


[edit]已修复链接-OriginalGriff [/edit]


[edit]Link fixed - OriginalGriff[/edit]

推荐答案

找出问题出在哪里并不难:您已经削减了n直接从某个地方粘贴代码,而不修改它以适合您的环境.

特别是,您需要使用与SQL数据库的正确连接替换您的连接字符串".
如果您在VS的服务器资源管理器"窗格中查找并突出显示您感兴趣的数据库,则连接字符串将显示在属性"窗格中.将其复制到您的SQlConnection中,然后看看会发生什么.

您可能还有其他问题;我无法从代码片段中分辨出-但这应该可以解决当前的问题.
It''s not too difficult to work out what is wrong: You have cut''n''pasted the code directly from somewhere, and not modified it to suit your environment.

In particular, you need to replace "Your Connection String" with a proper connection to your SQL database.
If you look in the Server Explorer pane of VS, and highlight the database you are interested in, then the connection string will be shown in the Properties Pane. Copy that into your SQlConnection, and see what happens.

You may have other problems; I can''t tell from the code fragment - but that should cure the immediate problem.


这篇关于"ADSDSOObject"失败,没有可用的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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