Wednesday, March 28, 2012

question regarding using the sql update command.

Here I have the following command

Dim dtNowAs DateTime = DateTime.Now
SqlDataSource1.UpdateCommand="Update [db] Set [LW]='TRUE', LWD=dtnow Where [PK]=@.PK"

What I was ttrying to accomplish was , in my grid view, when someone clicks update, it would automatically set LW to true and set LWD to today's date. No user intervention required. However, I figured the above script would not work. What would I have to do to make LWD = dtnow? I do not want to give the user the option to update anything.

Make it GetDate(). This is sql function to give u current date. No need to use a variable...

in case if u want to use variable

Dim dtNowAs DateTime = DateTime.Now

SqlDataSource1.UpdateCommand="Update [db] Set [LW]='TRUE', LWD=' " + dtnow.ToString() + " ' Where [PK]=@.PK"


|||

NICE! Thanks, anyway to clock this 3 hours ahead? The hosting company is 3 hours difference.

|||

ya that's correct os till its using my UK locationStick out tongue

No comments:

Post a Comment