|
actually i want to create a reminder for user in my system. i managed tp create a reminder date (nextMaintDate). But now i want to compare the date today with nextMaintDate, if its found to be the same, the data will out into listview that i create. i already do the coding but there is problem with my query..this is my coding:
date = DateTime.Today;
string query = "SELECT equipmentName FROM equipment WHERE nextMaintDate >= date";
**help me please, im begineer with this. but im try to do it...huhuhu
|
|
|
|
|
Different databases want's different format of the date as input.
Ex VFP want the date as {^YYYY-MM-DD} (Swedish setting of windows)
Which kind of database are you using?
Andreas
|
|
|
|
|
i use mySql database...so, u have any idea?
|
|
|
|
|
According to this link: http://www.htmlite.com/mysql003.php the date format is YYYY-MM-DD.
Do the query like this:
select * from [table] where [field_date] > 2006-02-01
This should work. (Sorry, don't have any mySQL to test on)
Use the date conversion routines for taking todays date and convert it:
DateTime dt1 = DateTime.Now;
String date=dt1.Year.ToString()+"-"+dt1.Month.ToString(2,'0'+dt1.Day.ToString().PadLeft(2,'0');
Hope this will help
Andreas
|
|
|
|
|
string query = "SELECT equipmentName FROM equipment WHERE nextMaintDate >= DateTime.Now";
actually if i want to put it in this query, it is can or not..
i try already but it has a problem with DateTime.Now...so, i cant retrieve the data.
|
|
|
|
|
DateTime.Now is C#, interpreted by the compiler, while you need to pass an SQL query that will be interpreted by your database (MySql.)
If you will always be comparing to today's date and time, SQL Server has the GETDATE() function that returns the current date and time. I have never used MySql but it should have a similar function. A quick Goolge should do it.
Or you can pass the date/time from your application. The other reply suggested concatenation to build the SQL query, but there are many disadvantages to that, one being security (see this[^] article), and the other that you depend on the date format.
The correct way to do it is to use parameterized queries (as the above-mentioned article explains). That way you won't have security vulnerabilities, and you won't depend on the specific date format.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
i want to run .exe file through C# code. I have a form which has a menu item; on click of this menu item, i must run this exe, which is from another application. Could anyone plz tell me how to go about...
Thanks
|
|
|
|
|
I got how to do it..thanks anyways
|
|
|
|
|
Plz check this.
string t = "-s -c \"I am going to Shut Down your mechine\" -t 20";
Process process = new Process();
process.StartInfo.FileName = "shutdown.exe ";
process.StartInfo.Arguments = t;
process.Start();
Enjoy Coding
Jijo
|
|
|
|
|
I want a Button Flat.
The problem is it get a border very large (3 px) also if i specify 1px for the border.
How can i reduce it?
|
|
|
|
|
I've a list of panels (100 or more) one over the other and all inside another panel.
I want to scroll up, down these panels.
What is the better way?
|
|
|
|
|
hi
I am looking for a piece of code in C# that sends mails thru Gmail programmatically. Already I am having POP3/IMAP code with me, expecting some thing using webRequest.
Also using POP3/IMAP protocol is not a good one(prob with the firewall etc and one should use webrequest /response to access Gmail server. Is that true?
Can any one guide me?
Regards
Arunagiri
-- modified at 4:15 Friday 17th February, 2006
|
|
|
|
|
Hi there,
How do I move rows up and down in a non-databound gridview?
Tom
|
|
|
|
|
How can I print the string path of the C# document I am currently using?
Like for example, I am programming sample.cs , is there a line of code i can insert into sample.cs that can print it's location? Thanks a lot!
|
|
|
|
|
No, you can't, as you are not executing the sample.cs file. You are executing the exe or dll file that is created from the code.
---
b { font-weight: normal; }
|
|
|
|
|
How about trying to access picture files without straight forward giving the directory of the picture folder? I tried asking the same question before and it worked for a while... After some time, the code did not work anymore and I don't know why. The following was the code:
String fileOfPic = "...//...//folder1//folder2";
Now it does not work anymore... and I don't know why..
|
|
|
|
|
You have to have some kind of fixed location relative to the image folder that you can use to determine where it is.
What is it that you are developing? A program? A web application?
Where is the image folder located?
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
How to run the Crystol Reports in ASP.Net, send me Code
Balu
|
|
|
|
|
hey whats ur problem u want to study some report concepts means prepare from some books dont post
VMSSanthosh
|
|
|
|
|
Hi,
I want Rotate My Image One after another in adrotator control without refreshing the page.
send me code if there is any possibility by using of HTML or JavaScript
I must to set that Image not on the entire page. Just in One location
Balu
|
|
|
|
|
I don't think that that is possible on the client side.
Use AJAX.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
How do i get a count of the number of forms in a project (.sln) file. I need to create an application in C# that can read a '.sln' file and and give me a count of the total number of forms in it. Any suggestions guys
|
|
|
|
|
The form files are listed in the project file, not the solution file. However, the solution file does list out the project files under it so you'll still need to read it. The solution file's format looks proprietary, so it looks like you have to parse it out yourself.
The project files are in XML. So, you can use .NET XML classes to easily read this. You'll want to count the File elements where SubType="Form".
|
|
|
|
|
Hi!!
I am a beginer in .net technology. Now i have to make a real time application - database program and i decided to use C# & the ado.net technology. I read some articles about this and now i have questions:
Is there a posibility to use the datagrid, and other controls in a connected mode?
This must be a real time system and i think the disconnected mode is a bad idea.
Or maiby the ado.net technology is not a good choise for this kind of applications, and i should use other technology
|
|
|
|
|
Hi all,
i have used the colorDialog from which the user can select a color for the text,
I have to display the color in a textBox but when i set the text of the textbox with the colordialog's color property it displays name for only limited colors and displays the RGB value for many of them.
How do i convert them to color names?
Any help in this regards will be appreciated.
Thanks & Regards,
Pramod
|
|
|
|