Advertisement

06.11.2008 at 05:10PM PDT, ID: 23477911
[x]
Attachment Details

vb.net - getting error "Option Strict On prohibits operands of Type Object for Operator '&'"

Asked by wally_davis in Microsoft Visual Basic.Net

Tags: vb.net, ie 7.0

I'm attempting to read a couple of Active Directory field values (fields are distinguishedName & Description) using the Microsoft.Visual Basic Class. However, I had two sets of code I merged (one set of code had Option Strict On and the other one I forgot to turn on) caused some errors to come up.
I received the error "Option Strict On prohibits operands of Type Object for Operator '&'" on this line of code: --> objRecordSet.Fields("distinguishedName").Value) <--     and then I received this error, "AccountDisabled is not a member of 'ADODB.RecordSet'." on this line of code: --> If objAccount.AccountDisabled Then <--.
Please see code snippet below. I would appreciate any assistance on which Classes/Methods or Properites to use NOW that I've implemented Option Strict On for all the code.
Many Thanks,
WDStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
'If there is still an available Host record and the Host is disabled in AD, lets disable it on the database if not already.
            ElseIf IsDBNull(objRecordSet.Fields("distinguishedName").Value) = False And IsDBNull(objRecordSet.Fields("description").Value) = False Then
                While Not objRecordSet.EOF
                    Dim objAccount As ADODB.Recordset = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName").Value)
                    If objAccount.AccountDisabled Then
                        ' Connect to DB and set the Status field to "Disabled" and
                        ' the Flag(soon to be DaysOffline) field to 29 days.
                        Dim sqlCon As New SqlClient.SqlConnection
                        Dim sqlCom As New SqlClient.SqlCommand
                        sqlCon.ConnectionString = My.Settings.ConnectionString
                        Try
[+][-]06.12.2008 at 06:34AM PDT, ID: 21769254

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 03:21PM PDT, ID: 21774181

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: vb.net, ie 7.0
Sign Up Now!
Solution Provided By: graye
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.13.2008 at 08:29AM PDT, ID: 21779952

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.13.2008 at 08:37AM PDT, ID: 21780037

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628