|
Im just starting to play with manipulating Active Directory using C# (never done any C# before).
I've followed some examples and extracted data for a given user, but its returning some odd data as follows:
badPasswordTime = System.__ComObject
lastLogoff = System.__ComObject
lastLogon = System.__ComObject
pwdLastSet = System.__ComObject
What is "System.__ComObject" and why am I not getting numeric data back?
Am I doing something wrong or missing something?
The code I am using (just a sample pulled off the web) is as follows:
<code> static void Main(string[] args)
{
string path = "LDAP://domain.com";
DirectoryEntry entry = new DirectoryEntry(path,"USERNAME","PASSWORD");
try{
Object native = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=ADTEST)";
foreach(SearchResult result in search.FindAll())
{
DirectoryEntry dirEntry = result.GetDirectoryEntry();
foreach (string key in dirEntry.Properties.PropertyNames)
{
foreach (Object propValue in dirEntry.Properties[key])
{
Console.WriteLine(key + " = " + propValue);
}
}
}
}
catch( Exception ex )
{ throw new Exception(ex.Message); }
Console.ReadKey();
}
}
}</code>
Any suggestions welcomed.......Thanks!
|
|
|
|
|
Hi All!
I have a little installation file, and after the user runs it, the app is installed, and all is good, I want to find the installation path. Can anybody tell me how I can do this?
Many thanks
Willem Le Roux
|
|
|
|
|
Hi
one & all
I need a solutions for small problem that i m not getting when i select some of the items in a listbox that items should be displayed in the datagrid with database records at run time.
So pls help me
Thanking u,
Regards,
Naren
please help me
|
|
|
|
|
i think there should not be any problem in this case. Simply get the selected values from list and pass them to get values from database for datagrid.
|
|
|
|
|
Hi
Thanks for your suggestion but i need to get at runtime, this case i m not getting it.
Regards,
Naren.
narendra
|
|
|
|
|
Hi everybody.
I have a project which is developed by visual c#.net by visual studio 2005.
It is a database project and because of damaging the connection in anywhere of my application, I put the main method in try catch block which handles SqlException.
When I run the application, the try catch code works. But when I execute my application exe, the try catch code does not work. And unhandled exception message is shown and says to handle SqlException exception. I really get confused what to do...
My code in visual studio running mode, works but when executing the exe file, it does not work. I think it is the worst error for programmers.
Please help me with my stupid problem.
Thanks
Rastgar
|
|
|
|
|
Hello All!
I have a richtextbox such that the user can copy-paste images into it. Now i am saving the 'rtf' of richtextbox in the database. Now after retrieving the 'rtf' and assigning it to Richtextbox, the image doesnt show up.
It is to be noted that the rtf before storing and after retrieving is the same.
Thanx in advance
regards
_mubashir
|
|
|
|
|
Hi!
From time to time visual studio 2005 shows a queer error message:
'Code generation for property 'Cursor' failed. Error was: ''CursorConverter' is unable to convert 'System.Windows.Forms.Cursor' to 'System.ComponentModel.Design.Serialization.InstanceDescriptor'.'
Maybe it happens because i use an own UserControl. But in fact this UserControl doesn't make anything with the property cursor ...
Is there anybody who knows this error message and can say what's wrong!?!?
Thanks in advance!
-- modified at 4:26 Tuesday 9th May, 2006
|
|
|
|
|
As far as I can tell, this seems to be a bug in Visual Studio (still present in VS 2008).
A workaround that worked for me was to mark the property with an attribute to make it invisible
to the designer, as follows:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Cursor MyCursor{ get; set; }
|
|
|
|
|
Cool! A response after more than three years
I thought I am the only one who has this problem, so I've learned to live with this Bug. But now I will try this workaround.
Many thanks!
occcy
|
|
|
|
|
Got my CustomRowEvent working..
able to fill my textboxes in my new form.
but i think it's not the fastest or best way.
i now use this line of code :
t075_BORGTOCHTNUMMER_1TextBox.Text = Grid["t075BORGTOCHTNUMMER1DataGridViewTextBoxColumn", RowIndex].Value.ToString();<br />
this work just great.. really..
BUT...
if you got about.. 60 textboxes.. it's kinna like a lot of work..
so i was thinking..
if i change my fill command with something like this..:
<br />
this.dBANBM_T075_BORGTOCHTTableAdapter.Fill(testdb1DataSet, Grid, RowIndex);<br />
he give's me the error that Grid and RowIndex does not excist in my current contex..
however..
i use the following code
<br />
public dborgtocht(testdb1DataSet DSet, DataGridView Grid, int RowIndex)<br />
{<br />
InitializeComponent();<br />
PopulateTextBoxes(testdb1DataSet, Grid, RowIndex);<br />
}<br />
so you really should think that he should be able to find them..
hope i explained enough now.
|
|
|
|
|
how can i define an array in c# and give it value?
|
|
|
|
|
|
int [] abc = new int[20]; where 20 is array length
or
int [] xyz = {1, 2, 123, 54, 67, 324}; //here you have defined constant array
in first case u can set array value by
abc[0] = 1;
abc[1] = 2;
abc[2] = 123;
Shajeel
|
|
|
|
|
I am doing a network application that involves DataTables transfer over the network, is there some way to convert the DataTable to an array of bytes to be transfered or even a way to transfer the whole DataTable through the socket layer without worrying about the underlying procedures.
Thanks in advance.
|
|
|
|
|
Can u pls tell me, wether following SQL string format is correct or not.
textWord.text,comboCat.text are string variables of C#.
indexInCategoryTable and SubCategoryNo are integer variables.
"select * from Words where
word = N'"+textWord.Text+"' and
CategoryTableName = '"+comboCat.Text+"' and
IndexInCategoryTable = 'indexInCategoryTable' and
SubCategoryNo = 'SubCategoryNo'";
|
|
|
|
|
No it is not, because your string values you are concatenating into the sql string but your integer values are not.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Can U Pls modify the above Query to make it correct.
|
|
|
|
|
Dear Friands,
I have two overloaded methods with the following signatures in 'MyClass' that is a class library in a dll file and I want to invoke a method from this dll at runtime by reflection:
public class MyClass()
{
public int MyMethod(ref int intParam)
{
intParam += 100;
return Math.Sin(intParam);
}
public int MyMethod(int intParam)
{
intParam += 100;
return Math.Sin(intParam);
}
}
When I use typeof(MyClass).GetMethod("MyMethod"); ,System.Reflection.AmbiguousMatchException is throw !!
If I use
typeof(MyClass).GetMethod("MyMethod",new Type [] {typeof(int)});
The second overloaded method with the value parameter invokes.
How can I force the CLR to run the first method and pass the parameter to it by reference ?
Regards,
Xironix
[ _ Always there is another way _ ]
|
|
|
|
|
Hi all, I am creating a text mining engine and after a button click i create inverted index and it takes quite a while to do so. Now i want some user interface to tell that something is in progress. i am using a static label lblStatus. and updating its value during different places in the function. but it doesnt work..
lblStatus.Text = "10% Completed";
and so on. but it is not working the label doesnot change it remain the same as it was in the start and when the index is completely created it shows 100% completed....
tell me how it will work.. or advise me wat other method should i use.
Regards,
|
|
|
|
|
Use
Application.DoEvents();
|
|
|
|
|
Sir plzz explain a little coz i m relative new commer in C#
Regards,
|
|
|
|
|
If you call DoEvents in your code, your application can handle the other events.
Say, you are are updating the label text by 10% within a function. You wont be able to see updated label text messages until the function has completed its execution. If you use Application.DoEvents() just after the update ui code, the function will continue its execution and you UI will be updated
label1.Text="20% completed";
Application.Doevents();
Have a look into this link
http://msdn2.microsoft.com/en-US/library/system.windows.forms.application.doevents.aspx
|
|
|
|
|
thxx Sir,
it is working exactly as i wanted it to
Regards,
-- modified at 11:21 Tuesday 9th May, 2006
|
|
|
|
|
I am creating a deployment project. I have used custom action, and installing database. Username and password will be get from user. I also edited password character as * using Orca. But i dont know how to set msiHiddenProperties for the password. Even though the password is *, The parameter shows the password and also in log file. How to hide the parameters and user entered text in log file. and also how to use verbose log method
my email id: haikumars@gmail.com
Thanks
KumarShanmugam
|
|
|
|