I have a problem re: DataBindings. I binded a textbox with a database in which I would like to show the date in it, but unfortunately I can't remove the time, so that in the textbox the date only is shown. How can I do it? The following is the code I used for databinding.
i think this code will help you ;
but first you should sign on the domain as a administrator
then add the active directory refference to the code below:
using System.DirectoryServices;// the active dirctory library
/// Summary description for WebForm1.
public class WebForm1 : System.Web.UI.Page
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.ListBox ListBox1;
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
private void retrivedata(string strDoamin)
DirectoryEntry obDirEntry = null;
obDirEntry = new DirectoryEntry("WinNT://" + strDoamin);
DirectoryEntries entries = obDirEntry.Children;
foreach (DirectoryEntry chil in entries )
if ( chil.SchemaClassName =="User")// to retrive the user only
ListBox1.Items.Add( chil.Name + "//" +chil.SchemaClassName);
catch (Exception ex)
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
private void InitializeComponent()
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
how to rotate images in cycle with link.
iam developing project to the musium.There various type of ancient type Categoriesare available. I have devided all in 6 Categories,so i like to rotate all Categoriesin cycle with picture.further more each Category has link that related to other information. Please give Ideas to begin project.
Does anyone know how to synchronize two databases (prefarebly mySQL) on different servers through C#?
What confuses me most is the comparing of the two databases. Note that the two databases can have the same data due to previous synchronizations. Also, the two databases can have different data but the same primary key.
I already worked with C# a while and I'd like to generate documentation. I've seen you can use '///' to add info in XML-style. So the XML can be parsed by using for example NDoc.
Is NDoc the best tool to use to generate C# Documentation? Any other software that I should use? (NDoc projet is not being update lately...)
I second NDoc, but as you have noticed they haven't released a binary for a while. Although there are currently working on a release for 2.0 framework features (like generics). I have a few c# 2.0 projects which could do with this.
Thanks for your time to read my request for a help. I developed my windows application with C#, which has many background workers working at the same time, opening and closing sql databases, modifying sql tables etc. Now, very often I get this error message, " There is already an open DataReader associated with this Command which must be closed first.". I dont know why its happenning sometimes and sometimes not. Is that the reason one thred and another thread conflicting each other when they try to read or modify same sql database ? And sometimes, I get some weired error saying "in order to execute the sqlcommand, connection must be open. ", And I dont see any reason why connection is getting closed before that sqlcommand execution. Now I had to place if(myConn.State == ConnectionState.Close) myConn.Open() ; before every sqlcommand. Even after that I am getting same error sometimes. Can anyone please give me some clue to solve and seal this problem permanently.
You can have any number of connections open to the database, so that is not the problem. The problem is most likely how you use the connection objects in your code. You can't share connetions between threads.