I have a DevExpress DatePicker component in my C# windows for application
Jassim Rahma wrote:
and I have a timestamp or datetime field in MySQL.
A timestamp is not the same as a date. Now if the value was carefully manipulated correctly every time it was inserted into the database then you would have a timestamp, NOT a date, which had a fixed time part.
If and only if that is the case then you can get the date part from C# per the other suggestions and then construct the time part and then do an exact match. Probably. (A range is still probably safer.)
If however the time part varies in the database then you MUST use a range check. So if the user picks 2012-12-31 then you create two timestamp values with the following values
start = 2012-12-30 00:00:00
end = 2012-12-31 00:00:00
Then you do a database comparison like the following
there is a exception when i create DirectoryEntry .
DirectoryEntry parent = GetDirectoryEntryByDn(path);
<big><b></b> DirectoryEntry user = parent.Children.Add("CN=" + user_name, "user");</big>
string oGUID = string.Empty;
user.Properties["samAccountName"].Value = user_name;
user.Properties["telephoneNumber"].Value = "15014088110";
user.Properties["streetAddress"].Value = "HZ";
oGUID = user.Guid.ToString();
the program run the line :
DirectoryEntry user = parent.Children.Add("CN=" + user_name, "user")
,the excpetion happened:
the exception InteropServicesCOMException "The specified Directory object is not bound to a remote resource" (and Error code
property is -2147463159)
Alright, I thought this would be simple, but apparently I don't know what I am doing. I have a Rich Text Box that populates upon form load. There are fields that are meant to be updated by text boxes on this form. Here's a snip of the form_load:
So what happens here is the form opens and populates a rich text box with:
CIF = N
Now, what I need to have a button do is update just the items I have defined, in this case chkCIF (a check box) and timeCIF.Text (a textbox). I have a button that's called update, and here's what it looks like.
privatevoid updateButton_Click(object sender, EventArgs e)
//There is a combo box on this form and example is the first optionif (comboInst.Text == "Example")
//Here is where the check box verification is, if it is true it should change the N to Yif (checkCIF.Checked == true)
//This part needs to update the current contents of the email body. Obviously, this isn't working for me so I commented out some examples I tried...//string s = emailBody.Text;//string chkCIF = "Y";//s = s.Replace("N", chkCIF);string theString = emailBody.Text;
theString.Remove(3, 2).Insert(3, "Y");
And there you have it. I just need to be able to update certain defined words from a string with a click of a button. Thanks in advance
Okay.... you are replacing/removing the text but then throwing the result away. You need to set your emailBody.Text back to the string that you have updated.
emailBody.Text = theString.Remove(3, 2).Insert(3, "Y");
I don't know too much about it but I do not believe that the stock rich text box supports the concepts of rows.... A cheap easy way to do what you want would be to split your string (Split function) replace the text in the resulting array and then rejoining the array back into a string. Easier than is sounds.
I understand what you're saying there and if a rich text box isn't the best way I think I can work backwards on what I want to do then.
How about writing the information to a text file, then calling it to the text box once it's updated in the text file?
Here is the "flow" of things:
Form loads and a .txt file is generated as a template.
User checks the box which makes the N turn into a Y in the text file.
User inputs the time into a text box.
User clicks the "Update Form" button which saves the text document and then pulls the entire document into the rich text box revealing the changes.
Does that sound like a better option? This just creates a new situation I have yet to attempt, but is on my "to learn" list, writing information to a specified position in a text file/reading from a text file.
Why not keep all the individual pieces of text as separate variables and then rebuild the RichTextBox[^] using its methods, whenever an item changes? This should make it much easier to add or remove specific items in the future.
i want to display a graph,i related it to my database "powerdb" it has a table called powertable with 2 attributes: "power" and "time",but when i run it,nothing appeares. only a white window.
publicpartialclass Form1 : Form
powerdbDataSet db = new powerdbDataSet();
privatevoid Form1_Load(object sender, EventArgs e)
// TODO: This line of code loads data into the 'powerdbDataSet.powertable' table. You can move, or remove it, as needed.this.powertableTableAdapter.Fill(this.powerdbDataSet.powertable);
chart1.Series.XValueMember = "time";
powertableBindingSource.DataSource = db.powertable;
privatevoid chart1_Click(object sender, EventArgs e)