Click here to Skip to main content
15,905,566 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
C#
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]Link fixed - OriginalGriff[/edit]
Posted
Updated 17-Mar-11 14:51pm
v3

1 solution

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.
 
Share this answer
 
Comments
shan1395 17-Mar-11 21:23pm    
thanks OriginalGriff,

Ofcoure i replaced all my connection string with SQl and AD.I don't want to paste the string here,that's why i mentioned "your string".
shan1395 17-Mar-11 21:28pm    
Ooops sorry it was a connection problem,just changed that but it throws different exception now

Incorrect syntax near '<'.
OriginalGriff 18-Mar-11 4:24am    
You mean "Incorrect syntax near '<'" in the code fragment we can't see? :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900