|
Maybe it is because you have not declared the variable. But unless you show us the actual code we have no way of knowing. And why are you trying to run VB.NET code as VBScript?
|
|
|
|
|
Stop. You're trying to use VB.NET code in the VBScript interpreter and that's just not going to work. The two languages are very different.
|
|
|
|
|
System.DirectoryServices.DirectoryEntry is a .NET Framework class.
You are using VBScript.
VBScript cannot use .NET Framework classes unless you create and register a COM-callable wrapper for them.
COM Callable Wrapper | Microsoft Docs[^]
VBScript has its own method for reading Active Directory:
Retrieve AD info for one user using VBScript[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello ,
Now I'm getting error like ADODB.Connection error '80040e21'
Read-only property value was not set.
My Code
cBase = "<ldap: dc="***,DC=***,DC=****,DC=****">"
cAttName = "samAccountName" 'FirstName.LastName
cObjUser = strUserName
cFilter = "(&(OU=***))"
cFilter = "(&(OU=***))"
cFilter = "(&(OU=***))"
cFilter = "(&(cn=***))"
cAttributes = "distinguishedName,name,description,gcbuildingnameenglish"
oQuery = cBase & ";" & cFilter & ";" & cAttributes & ";subtree"
Set objConnectionAD = CreateObject("ADODB.Connection")
objConnectionAD.Open "Provider=ADsDSOObject;"
Set objCommandAD = CreateObject("ADODB.Command")
objConnectionAD.Properties("User ID") = "****"
objConnectionAD.Properties("Password")= "*****"
objCommandAD.ActiveConnection = objConnectionAD
objCommandAD.CommandText = oQuery
Set objRecordSetAD = objCommandAD.Execute
if objRecordSetAD.RecordCount > 0 then
Set objUserAD = GetObject("LDAP://" & objRecordSetAD.Fields("distinguishedName"))
Select Case strADfield
Case "mail"
getADinfo = objUserAD.mail
End Select
else
getADinfo = ""
end if
'On Error Resume Next
Const ADS_SECURE_AUTHENTICATION = 1
Const ADS_USE_ENCRYPTION = 2
Any solution for this . I'm getting error in userid and password .
|
|
|
|
|
Hey guys, I hope that somebody here can help me ...
I have on my SQL SERVER 2014 DATABASE a table with a field Datetime Null
My date appears like 2019-05-15 00:00:00.000
When I filter with a stored procedure works fine using the params:
cmd = New SqlCommand("SELECT vta.datesale FROM Sales WHERE vta.datesale = @mydate", myConn)
cmd.Parameters.AddWithValue("@mydate", Now.Date())
but my trouble is when:
1.- I use the same cmd
cmd = New SqlCommand("SELECT vta.datesale FROM Sales WHERE vta.datesale = @mydate", myConn)
2.- I have a DateTimePicker and I choose any day
3.- My code in the event ValueChanged() of my DateTimePicker is:
a.- The same cmd in the number 1
b.- then ...
cmd.Parameters.AddWithValue("@mydate", dtMyDate.Text)
dtMyDate = Control DateTimePicker.
I'm receiving this error:
"Conversion of a varchar data type to a datetime data type resulted in an out-of-range value"
Somebody can help me?.
Thanks in advance and excuse my grammar; I'm not a native speaker and I don't like to use translators.
Javier.-
|
|
|
|
|
Member 11220465 wrote:
"Conversion of a varchar data type to a datetime data type resulted in an out-of-range value" Means the runtime tries to convert your datetime from a varchar, or string. You don't want that, if you're supplying DateTime, it should be interpreted as such. Show us your code, we'll be gentle.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks a lot for your time, Eddy ....
I'll share you (in Spanish) my screenshots
1.- Data storaged on my table Ventas
https://ibb.co/TBmHSm6
You can see: yyyy-mm-dd hh:mm:ss.sss .... The field is DateTime (accepting NULLS, before with no accept NULLs I had the same error).
2.- Code from the event ValueChanged() of my control DateTimePicker (dtFecha)...
https://ibb.co/pbsqnqP
3.- Error that I received when I try to access a day from my DateTimePicker that has data.
https://ibb.co/pQYTfQF
Thanks a lot, gentleman or any other bud that can help me. And again, excuse my grammar mistakes; I'm not a native speaker.
Thanks guys,
Javier.-
|
|
|
|
|
Member 11220465 wrote: And again, excuse my grammar mistakes; I'm not a native speaker. Your English is fine.
You are fetching the .Text property of the DataTimePicker , which returns a string. Then the code will try to turn that (locally formatted) string and convert it back to a DateTime , which then fails.
Try dtFecha.Value instead, it should give you a DateTime value, not a formatted string.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
You're awesome
Thanks a lot, Eddy .... You gave me the real clue in here ...
"Then the code will try to turn that (locally formatted) string and convert it back to a DateTime, which then fails."
When I read that, I used a MsgBox (to test) and you were right, dude
I tried with dtFecha.Value but failed .... but I picked another way: CDate(dtFecha.Text) and it's working fine
You guy, you're the real MVP hahaha
Thanks a lot, bud. A great hug and my best wishes for you and your family, my man
|
|
|
|
|
Glad I could help
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello ,
Can anyone tell me why Dim rootEntry As New DirectoryEntry(strServerName, adminAccount, adminPwd) throws error like Microsoft VBScript compilation error '800a0401' Expected end of statement . Please Help
|
|
|
|
|
|
yes but what is missing that I can't figure out . This particular code is working in C# with different syntax and also working in aspx file . Please help
|
|
|
|
|
|
yes it was syntax error . But now error is like Variable is undefined: 'DirectoryEntry' . System.DirectoryServices is not available in vb.net . Microsoft VBScript runtime error '800a01f4' . But it's assembly not variable
|
|
|
|
|
Have you added the reference to System.DirectoryServices in your project settings?
|
|
|
|
|
thanks it's solved but now I'm facing Variable is undefined: 'DirectoryEntry' error . System.DirectoryServices is not available in vb.net .
|
|
|
|
|
You appear to be using "VBScript" and "VB.NET" interchangeably. The two languages are VERY different.
So which is it? Are you using VB.NET or VBScript?
|
|
|
|
|
Sorry I noticed just now that I'm using vbscript
|
|
|
|
|
Show the code you have. Using types from the .NET Framework is not possible in all cases and you can't convert, line-for-line, the code you see in C# to VBScript.
VBScript cannot do a "new" of the DirectoryEntry class. To create an instance of a COM-exposed class in VBScript, you have to use CreateObject().
|
|
|
|
|
Hi everyone, I am new to VB.NET and wanting to create a small program which processes data from one CSV file to another.
example: I want to convert these fields into
Brand Mftr Code Description Long Description Dove Code RRP Price Qty Category 1 Category 2 Category 3 Image URL Product URL Barcode Current Due Date Stock Classification
__ Below mentioned fields.
Supplier ID; Active (0/1); Name *; Description; Short description; Meta title; Meta keywords; Meta description; Image URL
Is there any possibility, that I can create an application which manipulates data.
Any help would be much appreciated. TA
Cheers!
Vaz
|
|
|
|
|
Member 14173771 wrote: Is there any possibility, that I can create an application which manipulates data. Yes, but you probably need to spend some time getting familiar with some of the .NET classes that will help you. If you just want to read and write in csv format then you will need to use File and Stream I/O - .NET | Microsoft Docs[^] to read and write the data. The Working with Base Types in .NET | Microsoft Docs[^] will help in actually manipulating the content of the strings that you read.
|
|
|
|
|
Hi all,
I am totally new to VB.NET.
I am looking for a tutorial on how to create a VB.NET front end and MS Access database as background program.
I want to be able to generate an invoice with multiple lines of items, using a DataGridView to capture the data entry, and then store this invoice into an MS Access table.
Any assistance would be appreciated. Thank you in advance.
|
|
|
|
|
Tutorials are posted all over the internet and the best way to find them is to use Google. You can also go to the Articles section here on CodeProject* and see what is available on the subjects you are interested in. But if you are totally new to VB.NET you may find much of the information somewhat advanced.
*VB.NET Articles[^].
Database Articles[^].
|
|
|
|
|
My pc is connected to my local network through 192.168.1.5. Is there any way to get some string content through the browser? For example a very simple vb net code which will receive the string "HELLO" from the browser when i write 192.168.1.5:8888/HELLO ?
|
|
|
|