Monday, July 16, 2012 6:06 AM
Actually when user submit report in a day,user again submit report in the same day.. but i want user cannot submit the report twice in the same day ?? please help me..
my code is:SqlCommand comm = new SqlCommand("SELECT * FROM REPORT WHERE username='" + Label2.Text + "' and date=(SELECT Today=convert(varchar, GETDATE(), 101)) ", con);
SqlDataReader dr = comm.ExecuteReader();
Aaleert.Show("You can't submit the report twice in a day..............................");
SqlCommand cmd = new SqlCommand("INSERT INTO REPORT(username,report,date) SELECT '" + Label2.Text + "','" + TextBox1.Text + "',GETDATE()", con);
Monday, July 16, 2012 12:19 PM
Your SQL statement will return a string date value in the format MM/DD/YYYY (e.g. 07/16/2012). Is this the format of the date in your Label?
It's usually recommend that date values be compared in their native numeric format rather than as string/text values.
Paul ~~~~ Microsoft MVP (Visual Basic)
- Marked As Answer by Tony xiaoModerator Wednesday, July 25, 2012 10:47 AM
- Unmarked As Answer by Tony xiaoModerator Wednesday, July 25, 2012 10:49 AM
- Marked As Answer by Allen Li - AI3Microsoft Contingent Staff, Moderator Friday, August 10, 2012 3:27 AM