|
Taking your example, open up the MSDN page for the namespace. There'll you'll find a link to this[^] page.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you Eddy...I'm trying to find an express route to becoming self-sufficient as a C# programmer without having to read through a ton of tutorials, etc. for each task or technology I wish to explore such as System.Web or System.IO. I realize that, figuratively speaking, I may be asking to learn to speak spanish with a Spanish dictionary as my sole resource.
|
|
|
|
|
Quote: I'm trying to find an express route to becoming self-sufficient as a C# programmer without having to read through a ton of tutorials, etc. I'm afraid there is no express route. Becoming self-sufficient as a programmer in any language requires becoming familiar with that language, and that usually involves reading through a ton of tutorials, or attending a course (often years long), and/or continuing to read the documentation, articles, new releases etc etc etc.
In short, there is no shortcut
|
|
|
|
|
The only problem I find with the See Also links is once you dive down that rabbit hole it can take hours before I surface again and I have usually forgotten what I was researching in the first place.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: The only problem I find with the See Also links is once you dive down that rabbit hole it can take hours before I surface again
I find when learning anything new that it's always a struggle finding the minimum I need to know to produce anything useful. Once you've got to that point then it's a step-by-step process and Google/Bing!
Kevin
|
|
|
|
|
Also, please note that MSDN documentations are linked together, so if an object is used together with any other type or class, MSDN documentation will have a "See also" section at the bottom of the pages, where you can find details about other types. At the bottom of that page, (for DirectorySearcher), there was the section, https://msdn.microsoft.com/en-us/library/system.directoryservices.directorysearcher(v=vs.110).aspx#See Also, that had the information about the more objects that you should consider understanding.
Secondly, one must first understand what he has to do... Like, if you want to go to City 1234, then you should know the route to the destination, the local Bus Stop 12 and Bus Terminal 34 are just the in betweens. If you know where you are headed off to, then you will be easily able to find the correct types. — try search for "c# file system watcher" and, once you're working with that, search for "background thread event management", you will see that MSDN will provide you with the types you need to build a background manager that keeps a track of your file system for any changes in it. But of course, this is just an example.
Finding the correct classes is just like treasure hunt. Only this is somewhat easy, thanks to uncle Google.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
|
Hello,
I'm using a datagridview in windowsform application and would like to make changes and adding new records into my Datagridview.
After calling the BD.SavChanges() and using the BD.ChangeTracker.Entries(), only the modified rows are updated into the SQL table and no added rows.
Can you help me for this?
The DataGridView1.DataSource is the gammeBindingSource on the Form.
This is the code form my Form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.Entity.Infrastructure;
namespace PRODATA
{
public partial class Gammes : Form
{
PRODATAEntities BD;
public Gammes()
{
InitializeComponent();
}
private void Gammes_Load(object sender, EventArgs e)
{
BD = new PRODATAEntities();
BD.Configuration.ProxyCreationEnabled = false;
BD.Configuration.LazyLoadingEnabled = false;
gammeBindingSource.DataSource = BD.Gammes.ToList();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
foreach (DbEntityEntry entry in BD.ChangeTracker.Entries())
{
switch (entry.State)
{
case EntityState.Added:
entry.CurrentValues["Utilisateur"] = ((PRODATAparent)(this.MdiParent)).mUtilisateur;
entry.CurrentValues["Dateheure"] = DateTime.Now;
break;
case EntityState.Modified:
entry.CurrentValues["Utilisateur"] = ((PRODATAparent)(this.MdiParent)).mUtilisateur;
entry.CurrentValues["Dateheure"] = DateTime.Now;
break;
case EntityState.Deleted:
break;
}
}
dataGridView1.EndEdit();
gammeBindingSource.EndEdit();
BD.SaveChanges();
MessageBox.Show("Enregistrement effectué...", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
gammeBindingSource.ResetBindings(false);
}
}
}
}
Best regards.
modified 14-Mar-17 10:27am.
|
|
|
|
|
Hi,
I need to connect to LDAP but want to manage a timeout in case of problems connection to LDAP.
So, I want stop the 'binding' if it's not done (for example) in 10 seconds (and do not want to wait for the 'default' timeout of the server (which goes up to more than 45 seconds)).
Read something about the 'timeout'-property for the LdapConnection-class but it seems not to be working.
I've set the timeout-property to 10 seconds but the bind doesn't timeout after 10 seconds.
Can anyone please help me?
Thank you!
Here the code:
try
{
string context = string.Empty;
string root = null;
using (LdapConnection connection = new LdapConnection(root))
{
connection.Timeout = new TimeSpan(0, 0, 10);
connection.Bind();
var filter = "(&(objectClass=*))";
var searchRequest = new SearchRequest(null, filter, system.DirectoryServices.Protocols.SearchScope.Base, DEFAULTNAMINGCONTEXT);
var response = connection.SendRequest(searchRequest) as SearchResponse;
context = response.Entries[0].Attributes[DEFAULTNAMINGCONTEXT][0].ToString();
}
return 1;
}
catch (Exception ex)
{
return -1;
}
finally
{
}
|
|
|
|
|
from memory, you never get an 'exact' 'timeout'
I'm a bit worried about Quote: but the bind doesn't timeout after 10 seconds are we talking about the same thing ? if you bind successfully, you wont be timed out - the Timeout setting is to set a time +/- a factor that may depend on your network/the MSAD/LDAP server, that says 'time me out if I cant connect/bind to the server within this time'
(it could be that my understanding is wrong of course)
|
|
|
|
|
Hi Garth,
Thanks for your reply.
Indeed, if the bind is successful... no time out and everything is fine.
My concern is when the bind isn't successful ("server not reachable" for example): I want to 'time out' if the bind hasn't been established within (for example) 10 seconds.
I did the test with the code I posted setting the timeout on 5 seconds: the time out was not near the 5 seconds... it gets up to 90seconds.
So, it seems that or my code is wrong or the 'timeout'-property is not used for this purpose...
Thanks,
Marc.
|
|
|
|
|
hmmm, well, obviously you're using System.DirectoryServices.Protocols LdapConnection otherwise the Timeout property wouldn't be exposed (System.DirectoryServices was the old model that didn't expose/honour any timeout)
I wouldn't have expected 90 seconds though, and unfortunately these days I'm not in a position to test for you .. are you sure you're timing the right thing (sorry to play 'second guess a pro')
what happens if you put
stopWatch.Start();
connection.Bind();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
Console.WriteLine("Bind Time " + elapsedTime);
|
|
|
|
|
Indeed, I 'switched' from System.DirectoryServices to System.DirectoryServices.Protocols in order to have the property 'Timeout' at my disposal.
I've timed like you suggested... and no surprises (for me)
- when no problem : 00:00:00.18
- when problem ("server not reachable") : 00:00:50:05 (and above)
|
|
|
|
|
obviously I don't know your network environment, whether your client is on one subnet and the MS AD/LDAP server on another (routing issues) and what other factors may be involved - MS AD/LDAP running on an under-powered server or all sorts of things in-between
if
MarcSchmidtmayer wrote: 00:00:50:05 (and above)
is hard to swallow - if you have a user looking at a GUI I'd suggest authenticating in the background and keeping the user happy, if its a high speed automated process or something, well, if you cant get a better response time to the server via the network/increase server threads/performance etc I'd be thinking about some 're-architecting' of the software stack, caching ...
|
|
|
|
|
Unfortunate is the fact that I can't make up if it's the 'TimeOut'-property that doesn't work
(like I think) or that it is a 'network issue'.
When I read your answers, I guess you also believe that the 'TimeOut'-property should work...
Anyhow... thanks for your answers and suggestions...
Don't forget to let me know whenever you should haven another 'idea'...
|
|
|
|
|
there is no timeout property for Bind. no solution found for .net core.
Kamran Shahid
Sr. Software Engineer
(MCP, MCAD.net, MCSD.net, MCTS, MCPD.net[web])
Netprosys Inc.
www.netprosys.com
|
|
|
|
|
Wow, your internet connection must be terrible! Your first post in over eight years, and it's a response to a thread from 4½ years ago.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Probably a 600 baud line.
|
|
|
|
|
hehehehehehehhehehe
Kamran Shahid
Sr. Software Engineer
(MCP, MCAD.net, MCSD.net, MCTS, MCPD.net[web])
Netprosys Inc.
www.netprosys.com
|
|
|
|
|
There is a way to get QuickSharp to run your program in a separate window but I can't find any info on this. Anyone have any insight into this?
|
|
|
|
|
|
I assume you are talking about the version on SourceForge. You would be better off asking questions like this on the forum there. Alternatively, you could read the documentation[^].
This space for rent
|
|
|
|
|
microsoft report viewer simple invoice format code c#
send me full code
how to add grid in report viewer
|
|
|
|
|