473,739 Members | 6,655 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 1046

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

Similar topics

6
2687
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
9614
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
4521
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
1290
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
2115
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
1947
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
1295
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
4599
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
1662
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
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
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
8215
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
6754
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
4570
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...
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.