delete question

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
 
K

Ken Cox [Microsoft MVP]

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.
 
S

Steven Cheng[MSFT]

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
 
S

Steven Cheng[MSFT]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top