Wednesday, January 28, 2009

problem inserting a date into a SQL server

You should format the date using the ISO unseparated date format, which is YYYYMMDD. Do not use any separator for the year, month, or day. Like this....

Insert Into SomeTable(DateColumn) Values('20090128')
Or
Update SomeTable Set DateColumn = '20090128' Where Id = 1

If you have a time included with your date, then the format should be: YYYYMMDD hh:mm:ss
Ex: '20090128 5:05 PM'
If you use this format, you will never have a problem.

Saturday, January 24, 2009

On Refresh of Page avoid adding of new data in database

use:

Response.Redirect("~/samepage",false);

Navigating Pages in asp.net

If you are trying to go to another page:
Response.Redirect ("Page.aspx")

If you are trying to go to a folder:
Response.Redirect ("~/Folder/Page.aspx")

If you are trying to come from a folder:
Response.Redirect ("../Page.aspx")