Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Adding Two Variables in vbs

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,48982
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding Two Variables in vbs
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Adding Two Variables in vbs - 7/2/2007 10:17:32 PM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
 
Hallo,

I got a issue with adding two variables in my script.

Could anybody suggest me some idea how to solve the issue?

Below code doesn't work

Call UpdateProperty(objtargetuser,"displayname",objRecordSet.Fields("sn") & ", "  & objRecordSet.Fields("givenname").value)
objtargetuser.SetInfo

I tried this too , still it is not working

Call UpdateProperty(objtargetuser,"displayname",objRecordSet.Fields("sn").value  & ", "  & objRecordSet.Fields("givenname").value)
objtargetuser.SetInfo


Below code works for one vairable.

Call UpdateProperty(objtargetuser,"displayname",objRecordSet.Fields("sn").value)
objtargetuser.SetInfo

Thanks.


Regards,

Atul
 
 
Post #: 1
 
 RE: Adding Two Variables in vbs - 7/2/2007 10:47:27 PM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
Additional Info regarding the script.

Adding of the variable doesn't work , when i run the script to copy users from Lotus Domino 7.0 to Active Directory.

Is their any special syntax in visual basic script for Lotus Domino??

But the same adding script work when i copy the user information from Active Directory to another Active Directory and E-Directory (from Novell) to Active Directory.


(in reply to atulisc)
 
 
Post #: 2
 
 RE: Adding Two Variables in vbs - 7/3/2007 1:22:15 AM   
  ebgreen


Posts: 5032
Score: 31
Joined: 7/12/2005
Status: online
Try this:

strTest = objRecordSet.Fields("sn").value  & ", "  & objRecordSet.Fields("givenname").value
WScript.Echo strTest
Call UpdateProperty(objtargetuser,"displayname",strTest)

Verify that the string is what you think it is.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to atulisc)
 
 
Post #: 3
 
 RE: Adding Two Variables in vbs - 7/3/2007 4:02:27 AM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
I get Type Mismatch error ,when  i try below solution.

strTest = objRecordSet.Fields("sn").value  & ", "  & objRecordSet.Fields("givenname").value
WScript.Echo strTest
Call UpdateProperty(objtargetuser,"displayname",strTest)


This code works with one variable.

strTest = objRecordSet.Fields("sn").value 
WScript.Echo strTest
Call UpdateProperty(objtargetuser,"displayname",strTest)

I think their is some issue with concatenation of string. It is not able to add to strTest both sn and givenname.

Regards,
Atul

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: Adding Two Variables in vbs - 7/3/2007 4:13:11 AM   
  ebgreen


Posts: 5032
Score: 31
Joined: 7/12/2005
Status: online
Try:

WScript.Echo objRecordSet.Fields("givenname").value


Because it sounds like it is not returning a string.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to atulisc)
 
 
Post #: 5
 
 RE: Adding Two Variables in vbs - 7/3/2007 6:47:14 PM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
With below code, i meant it works either with sn or givenname , not both together.

This works too

strTest = objRecordSet.Fields("givenname").value 
WScript.Echo strTest
Call UpdateProperty(objtargetuser,"displayname",strTest)

Regards,

Atul



(in reply to ebgreen)
 
 
Post #: 6
 
 RE: Adding Two Variables in vbs - 7/4/2007 6:09:03 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Run this and see what it tells you.
The .givenName and .sn fields should only be strings, but this is a good way to test:

      



_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to atulisc)
 
 
Post #: 7
 
 RE: Adding Two Variables in vbs - 7/4/2007 9:26:35 PM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
Hallo ,

I didnt understood what you like to have output from the code . You can explain to me if i am wrong.

code gave me output , who is running the script.

My Operating system username , if i am running from my client and if i am running the same code from server it gives operating system username from server.

givenname=Lastname, sn=Firstname
sn=firstname , givenname=Lastname


Regards,

Atul

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 8
 
 RE: Adding Two Variables in vbs - 7/4/2007 11:48:07 PM   
  atulisc

 

Posts: 6
Score: 0
Joined: 7/2/2007
Status: offline
Hallo friends,

I found the solution on my own.

Below solution might help you too , if someone get stucks in their coding.


Call UpdateProperty(objtargetuser,"displayname",(join(objRecordSet.Fields("sn").value) & " " & join(objRecordSet.Fields("givenname").value)))
objtargetuser.SetInfo
 or  strTest = (join(objRecordSet.Fields("sn").value) & "," & join(objRecordSet.Fields("givenname").value))
wScript.echo (strTest ) Thanks for quick reply. Regards, Atul

(in reply to atulisc)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding Two Variables in vbs Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts