I have created a sp querying LDAP such as:
I sign on to Sequel Server 2005 in Windows Authentication mode and execute the sp:Code:ALTER PROCEDURE [dbo].[sp_LDAP_Query] as set nocount on select * from openquery(ADSI, ' select title, sAMAccountName, displayName, userAccountControl from ''LDAP://DC=xxx,DC=COM'' where objectCategory = ''User''') where title is not null and (userAccountControl <> '66050' and userAccountControl <> '514') order by displayName
A result set is returned. So far, so good.Code:exec vecellio.dbo.sp_LDAP_Query
Now in ASP I have a connection string like:
also using Windows Authentication and code to call the same sp:Code:<add key="ConnectionString" value="Data Source=VGIBESQL;Initial Catalog=XXX;Integrated Security=SSPI;"/>
Now I get error on the "mySqlCommand.ExecuteScalar()" line:Code:If mySqlConnection.State = Data.ConnectionState.Closed Then mySqlConnection.Open() End If Try mySqlCommand.Connection = mySqlConnection mySqlCommand.CommandType = Data.CommandType.StoredProcedure mySqlCommand.CommandText = ("vecellio.dbo.sp_LDAP_Query") mySqlCommand.Connection = mySqlConnection mySqlDataAdapter.SelectCommand = mySqlCommand mySqlDataAdapter.Fill(mySqlDataTable) Session("myMenuDataTable") = mySqlDataTable Catch ex As Exception Message = ex.ToString myError = True End Try
Any ideas???Code:System.Data.SqlClient.SqlException: An error occurred while preparing the query " select title, sAMAccountName, displayName, userAccountControl from 'LDAP://DC=Vecelliogroup,DC=COM' where objectCategory = 'User'" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".




Reply With Quote