|
No problem!
By using a property as in the code I posted, or using DateTime.Now each time directly rather than a cached field as you were attempting previously.
Edit: If you want to make it a little less wordy to access you could just create a static property or method that does it all for you:
public static class DateTimeHelpers
{
private const string MonthDayFormat = "MM/dd";
public static string NowMonthDayString
{
get { return DateTime.Now.ToString(MonthDayFormat); }
}
}
textBox1.Text = DateTimeHelpers.NowMonthDayString;
|
|
|
|
|
Sorry Dave, didn't realize you had already prevented that from becoming a problem. I just added another private const string to display hours and minutes how I desired, and it works flawlessly, you sir, are a gentleman and a scholar 
|
|
|
|
|
You're welcome
|
|
|
|
|
Class Paramaters
Parameters.time.ToString(Parameters.formatDate);
And also
- or you should instintiate the Parameter class
- or make the members static.
I would also advice in using properties instead of members directly.
|
|
|
|
|
I'm still quite new the WCF Services
School assignments that I done on WCF were writing simple methods of WCF service which accepts strings or int or bool values.
However, I came across this wcf service that wasn't done by myself, and now I am required to write C# client to consume this service.
This WCF has a GetFees method which takes a Student Object as parameter (from WCF's Student DataContract)
See this image for how Student and Fee's datamembers
http://oi47.tinypic.com/wtgap3.jpg
My assignment is to Get Fees of particular students. The information i'm given are
StudentID=1, FirstName=Fernando, LastName=Gadd, Grade=4
StudentID=3, FirstName=Allan, LastName=Pascoe, Grade=1
Currently stuck on how to approach this question, but i'm thinking something like
Fee[] newFee1 = client.GetFees(new Student("1", "Fernando", "Gadd", "4".......
Fee[] newFee2 = client.GetFees(new Student("3", "Allan", "Pascoe", "1".......
Thank you whoever can help
|
|
|
|
|
hi all
i have 2 RFID readers that read active RFID tags ID within range, and i have written the code in c# and it works and reads the tags. each tag represents a device.
i have created a database on MS access provides information related to each tag, such as serial number, location, company,...
ISSUE: i need to insert the tag ID to the database and only update Location coloumn, AOTUMATICALLY. as long as the reader reads the tag the program has to update the location where the rest information will be as they are.
i have 2 readers (reader A & reader B) so that i have to compare the data coming from each reader in order to update the location. if reader A reads the tag ID and reader B doesn't >> location updated to Location A. while if reader B reads the tag ID and reader A doesn't >> location updated to Location B. and if neither of 2 readers read the tag the location will be (OUTBOARD). also if the readers read the tag ID at the same time ( readers range interfere), the location will be (mutual A&B).
readers are real time working, and i need to do the updating aotumatecally & continuously.
I really need help ASAP.
|
|
|
|
|
Basic process
1. Create (learn) how to do database insert and update. This does NOT have anything to do with the reader data. It is just basic knowledge.
2. Use 1 to create an API that creates/updates RFID data. This has NOTHING to do with getting the data.
3. Write code to read from a SINGLE reader and then call the API in 2.
4. Create (learn) two threads. Each thread calls 3. Maybe with a delay or maybe not. Depends on how you tell if the reader has data or not.
|
|
|
|
|
first of all, thank u for ur reply.
second:
1- somebody told me that there is library codes already created to do this purpose, is that true? and where can i find them?
2- i'm not a programmer, unfortunately, so that i really need more explanation.
3- if u don't mind we could communicate on skype or teamviwer,..etc, to discuss these steps.
4- if u mind, can u provide me the best and easiedt references on tutorials?
5- if u know someone is ready to solve my problem and programs it i'll be really thankful.
|
|
|
|
|
Eng.almasrouhi wrote: if u know someone is ready to solve my problem and programs it
You would need to hire a programmer to do this then. Highly unlikely that anyone is just going to do all of this for you for free.
|
|
|
|
|
actually, i'm looking for a programmer to hire. of course i'll pay him but i need to find one first.
|
|
|
|
|
Eng.almasrouhi wrote: i'm looking for a programmer to hire
The you need to go to such a site. This site is not it.
|
|
|
|
|
"I'm not a real doctor. Just relax, you won't feel a thing."
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Eng.almasrouhi wrote: and i have written the code in c# and it works and reads the tags. each tag
represents a device.
This statement would seem to be at odds with your other post that says you are not a programmer.
Eng.almasrouhi wrote: I really need help ASAP.
Per your other comment that you want to hire someone.
You might want to look to a employment agency and an employment lawyer. Both should have experience with software.
The first provides candidates. The second insures that what you get is what you paid for.
1. You should improve your requirements.
2. Make sure that the lawyer knows that you want to retain ownership of the code.
3. Make sure that the lawyer knows that you want to insure the product works. To that end your requirements will need to state HOW you would determine that.
4. Make sure that hte lawyer knows that will want to provide bug fixes to the code. Or not if you want to try to do it yourself.
Then you just need to find a candidate you like, get them to sign a contract (the lawyer approved one) and then get out your check book.
You probably should pick a local candidate because then you can sue them if they fail to deliver (breach of contract.) Doing that is generally easier if it is local although there are some localities where it is better for you (contractor) than for the (contractee) which is something else you should ask the lawyer.
|
|
|
|
|
what is wrong with this query ?
i cant find them...
i use c# and access database.
command.CommandText = (@"UPDATE Users_Table SET Password= '" + txtNewPassword.Text.ToString() + "' WHERE (Username='" + txtUsername.Text + "' AND Password='" + txtOldPassword.Text + "' )");
command.ExecuteReader();
|
|
|
|
|
What is the error message?
Or why not throw that sql into a string. And then set the .commandtext as this string?
like::
string sqlSelect =
"UPDATE Users_Table SET Password= '" + txtNewPassword.Text.ToString() + "' WHERE Username='" + txtUsername.Text + "' AND Password='" + txtOldPassword.Text + "'");
command.CommandText = sqlSelect;
Also, I did notice an extra space at the time of closing the sql.
txtOldPassword.Text + "' )");
Change to
txtOldPassword.Text + "')");
|
|
|
|
|
the error message is :Syntax error in UPDATE statement.
can i use sql commands when i use access database???
|
|
|
|
|
You can use it. But make sure you specify in the connection string, that the database type is access.
Can you print out the sql in your c# program, log onto access, and try to run the same update statement in access.
|
|
|
|
|
string sqlSelect = string.format("UPDATE Users_Table SET Password= '{0}' WHERE Username='{1}' AND Password='{2}'",txtNewPassword.Text.ToString(),txtUsername.Text,txtOldPassword.Text);
command.CommandText = sqlSelect;
you can also try like this.
|
|
|
|
|
First and foremost, you do NOT use string concatentation to built a query like that. Why? Just Google for "SQL Injection attack" and you'll find out. A big problem with what you've done is what happens if the user types a ' character in their password?? I guarantee that it'll break your code and give you the error that you're talking about.
Then you can Google for "C# SQL Parameterized queries" to find out how to do it correcly. This also has the benefit of making your code easier to debug and maintain.
Next, why are you calling .ToString() on a string?? The Text property always returns a string, so there's no need to call .ToString() on it!
And finally, with an UPDATE statement as yours, you would normally use ExecuteScalar, no ExecuteReader, to launch it.
|
|
|
|
|
Now i have prevent my access database from injection??
I have the same error yet.
OleDbConnection connect = new OleDbConnection();
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\user\Desktop\Laiki_Trapeza_Questionnaires.accdb;Persist Security Info=False;";
connect.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connect;
string OldPassword = txtOldPassword.Text;
string Username = txtUsername.Text;
string Password = txtNewPassword.Text;
command.CommandText = (@"UPDATE Users_Table SET Password=@Password WHERE (Username=@Username AND Password=@OldPassword )");
command.ExecuteReader();
MessageBox.Show(" Succesfull update password!");
connect.Close();
modified 11-Mar-13 17:32pm.
|
|
|
|
|
Yeah, you never supplied the values for any of the parameters. Keep reading those links. You might want to pick out stuff that mentions "OldDbParameter".
|
|
|
|
|
what did you mean ? these commands must become
string OldPassword = txtOldPassword.Text;
string Username = txtUsername.Text;
string Password = txtNewPassword.Text;
like this:
command.Parameters.AddWithValue(@"OldPassword", txtOldPassword);
command.Parameters.AddWithValue(@"NewPassword", txtNewPassword);
command.Parameters.AddWithValue(@"Username", txtUsername);
????
sorry but i don't understand what you mean with Keep reading those links. You might want to pick out stuff that mentions "OldDbParameter".
modified 12-Mar-13 15:00pm.
|
|
|
|
|
Hi,
I am using WMI to make a call to an executeable on a remote server.
I have this defined in the managementpath, \\\\<servername>\\root\\cimv2:Win32_Process
My actual exe is located on the D drive of the same machine.
Is it required that this exe also be located on the C drive of the remote server????
Also, in the ManagementBaseObject class, method the InvokeMethod as a returnValue parameter. What are all the possible values for this parameter?
What value is returned if successful versus failed?
Thanks so much!!
modified 11-Mar-13 15:27pm.
|
|
|
|
|
Try reading the documentation on the Win32_Process class, Create method.Create method[^] for the return values.
If you're trying to run a process remotely that puts up a user interface, like Notepad for example, for the logged in user to see, you can't. It's a HUGE security risk, so WMI won't let you do it.
You CAN however run an executable that does NOT show any user interface, like a Console application.
You can launch the .EXE with the file being on your machine but ONLY if the .EXE file resides in a network share ono your machine. If you don't understand Windows Networking, just copy the .EXE file to the target machine and launch it from there. It's much simpler to do.
|
|
|
|