473,762 Members | 5,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SearchresultCol lection not accessible because it's private?

I'm getting an error when I try to access the properties in oResult,
stating: "System.Directo ryServices.Sear chResultCollect ion.Properties is
not accessible in this context because it is 'private'". I don't
understand why, since I've passed it as a parameter to the sub. Thanks
in advance for any help.
Here's the entire (unfinished) sub:

Sub insertADRecords (ByVal strCurrOU As String, ByVal oResult As
SearchResultCol lection)
Dim iIndex1 As Integer
Dim strSql, strDN, strProxyAdd, strProxy(), strMyString As
String, rowsAffected As Integer
sqlConnection.O pen()
Dim sqlCMD As SqlClient.SqlCo mmand = New SqlCommand("INS ERT
INTO Tradoc.dbo.Curr AD (objclass, cn, mailnickname, targetAddress,
proxyAddresses, displayname," _
&
"givenName,init ials,sn,title,t elephoneNumber, company,departm ent,physicalDel iveryOfficeName ,l,st,postalcod e,"
_
& "co,ou,dn,adspa th) VALUES
(?,?,?,?,?,?,?, ?,?,?,?,?,?,?,? ,?,?,?,?,?,?))" )

For Each oResult In objRS

sqlCMD.Paramete rs.Add(New SqlParameter("@ objclass",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ cn",
SqlDbType.Text, 100))
sqlCMD.Paramete rs.Add(New SqlParameter("@ mailnickname",
SqlDbType.Text, 100))
sqlCMD.Paramete rs.Add(New SqlParameter("@ targetAddress",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ proxyAddresses" ,
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ displayName",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ givenName",
SqlDbType.Text, 100))
sqlCMD.Paramete rs.Add(New SqlParameter("@ initials",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ sn",
SqlDbType.Text, 100))
sqlCMD.Paramete rs.Add(New SqlParameter("@ title",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ telephoneNumber ",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ company",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ department",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New
SqlParameter("@ physicalDeliver yOfficeName", SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ l",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ st",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ postalcode",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ co",
SqlDbType.Text, 50))
sqlCMD.Paramete rs.Add(New SqlParameter("@ ou",
SqlDbType.Text, 400))
sqlCMD.Paramete rs.Add(New SqlParameter("@ dn",
SqlDbType.Text, 300))
sqlCMD.Paramete rs.Add(New SqlParameter("@ adspath",
SqlDbType.Text, 400))

'************** *************** *************** ***************
Try
'I get the errors below where it says "oResult.Proper ties("xxx")(0)"
sqlCMD.Paramete rs("@objclass") .Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ob jClass")(0))))
sqlCMD.Paramete rs("@cn").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("cn ")(0))))
sqlCMD.Paramete rs("@mailnickna me").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ma ilnickname")(0) )))
sqlCMD.Paramete rs("@targetAddr ess").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ta rgetAddress")(0 ))))
sqlCMD.Paramete rs("@proxyAddre sses").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("pr oxyAddresses")( 0))))
sqlCMD.Paramete rs("@displayNam e").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("di splayName")(0)) ))
sqlCMD.Paramete rs("@givenName" ).Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("gi venName")(0))))
sqlCMD.Paramete rs("@initials") .Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("in itials")(0))))
sqlCMD.Paramete rs("@sn").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("sn ")(0))))
sqlCMD.Paramete rs("@title").Va lue =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ti tle")(0))))
sqlCMD.Paramete rs("@telephoneN umber").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("te lephoneNumber") (0))))
sqlCMD.Paramete rs("@company"). Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("co mpany")(0))))
sqlCMD.Paramete rs("@department ").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("de partment")(0))) )
sqlCMD.Paramete rs("@physicalDe liveryOfficeNam e").Value
=
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ph ysicalDeliveryO fficeName")(0)) ))
sqlCMD.Paramete rs("@l").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("l" )(0))))
sqlCMD.Paramete rs("@st").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("st ")(0))))
sqlCMD.Paramete rs("@postalcode ").Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("po stalcode")(0))) )
sqlCMD.Paramete rs("@co").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("co ")(0))))
sqlCMD.Paramete rs("@ou").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ou ")(0))))
sqlCMD.Paramete rs("@dn").Valu e =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("dn s")(0))))
sqlCMD.Paramete rs("@adspath"). Value =
strQuoteReplace (Trim(Convert.T oString(oResult .Properties("ad spath")(0))))

If sqlConnection.S tate = ConnectionState .Closed Then
sqlConnection.O pen()
End If
rowsAffected = sqlCMD.ExecuteN onQuery()
Catch ex As Exception
Finally
sqlCMD.Dispose( )
End Try
Next
End Sub

Mar 1 '06 #1
0 1058

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2689
by: Gunnar Beushausen | last post by:
Hi! I need a class to store the users data (ID, name etc.) that is accessible from anywhere. At application startup the class gets filled with its data about the user. But how can i access this data from all other classes? Normally to get access, i would have to say something like UserData *UD = new UserData; But this way a new class gets instantieted. What can i do to
12
9619
by: hykim | last post by:
Hello, everyone. according to MSDN, there is any constructor of System.DirectoryServices.SearchResultCollection Class. if I implement DirectorySearcher.FindAll() method by myself, then how can I instanciate SearchResultCollection Class. more clearly, a SearchResult object is created, at the inside of FindAll() method, then how can I put this object into the SearchResultCollection object. there is any method releated to input operation.
4
4522
by: Adriano Coser | last post by:
I'm getting the following error: error C3767: PictureSource - candidate function(s) not accessible when accessing a public member function of a managed class, either from managed or unmanaged code. The class is an owner draw control implemented into a Control Library. The access is on a DLLs that support CLR with old syntax. The code compiled OK on Beta-1.
0
1294
by: mg | last post by:
SearchResultCollection resultCollection = LDAPsearcher.FindAll() SearchResult resultArray resultArray = new SearchResult resultCollection.CopyTo(resultArray,0) resultCollection.Count is But many fewer than N items appear in resultArra How can I get all N items to appear in resultArray?
0
2123
by: mg | last post by:
SearchResultCollection resultCollection = LDAPsearcher.FindAll(); SearchResult resultArray; resultArray = new SearchResult; resultCollection.CopyTo(resultArray,0); resultCollection.Count is N But many fewer than N items appear in resultArray How can I get all N items to appear in resultArray?
3
1949
by: Tim Zych | last post by:
If I declare a procedure in a webform as Public and attach it to a button in the same webform, it runs fine. If I change it to Private Sub and try to click it i get the error: 'codelib.editcode.Private Sub SaveRecord(sender As Object, e As System.EventArgs)' is not accessible in this context because it is 'Private'. What am I doing wrong? Everything is in one webform.
3
1299
by: Tim::.. | last post by:
Can someone please tell me why I'm getting the following error! I have absolutely no idea why this error keeps appearing! Thanks for any help! Compiler Error Message: BC30390: 'cpncms_v1.evtCalendar.Private Sub Calendar1_DayRender(sender As Object, e As System.Web.UI.WebControls.DayRenderEventArgs)' is not accessible in this
5
4603
by: Ryo | last post by:
Hello ! I want to know if there are an easy way to put a SearchResultCollection (resulting of a query on Active Directory) into a DataSet ? Thanks;
7
1666
by: Mike | last post by:
According to the MSDN (see reference below), it is possible to change a base class function from public to private. How is this done? I've tried using "new", but the function is still accessible. From MSDN: "A derived type can hide an inherited member by defining a new member with the same signature. This might be done to make a previously public member private or to define new behavior for an inherited method that is marked as final."
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.