delete question

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

In my grid I"m showing my date as {0:yyyy/M/d}
now my date is the key in the table so i need it to be as it is in the table
to delete
mm/dd/yyyy, How can I reverse the display format so i can delete the row?

i have
dim eDate as string

strSQL = "DELETE from Points where eDate = ' " & eDate & " ' "

I need to make it the correct format to delete
 
Hi Mike,

One idea would be to store the original date (unformatted) in another column
but turn off its display. You can still access its value by getting it from
the hidden column.
 
Hi Mike,

As for the problem on retrieve back the output date string and format back
to the original format, I think you can try using the DateTime.Parse method
to reconstruct a DateTime instance from a date string such as:
DateTime date1 = DateTime.Parse("2004-5-2");
DateTime date2 = DateTime.Parse("5/2/2004");
DateTime date3 = DateTime.Parse("2004/5/2");

Then, we can get whatever output format of the datetime via its ToString
method, just as:
Response.Write("<br>yyyy/M/d: "+ date.ToString("yyyy/M/d"));
Response.Write("<br>mm/dd/yyyy: " + date.ToString("mm/dd/yyyy"));
Response.Write("<br>yyyy-mm-dd: " + date.ToString("yyyy-mm-dd"));

For more info on the DateTime class 's Parse or ToString format, you can
reference the msdn library:

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcustomdatetimeform
atstrings.asp?frame=true

In addition, I also recommend that you consider Ken 's suggetion on use a
hidden column to hold the original Date info. That'll be more convenient.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Hi Mike,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top