![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
If you write your codes as the following: sqlp(1) = New System.Data.SqlClient.SqlParameter("@currentdateti me", "GETDATE()") Then "GETDATE()" will be a string and your app (probably) raise an error as @currentdatetime will not be a valid datetime (but your app probably expects a datetime data type) value but a string. It'll be a string when you put something in quotation marks. Instead, if you write your codes using VB.Net you should use the following: ("@currentdatetime", Date.Today) Then, @CurrentDateTime parameter's value will be the date of today. Getdate() is a function in SQL Server, not in VB.Net for instance... -- Ekrem Önsoy "Clay" <Clay (AT) discussions (DOT) microsoft.com> wrote in message news:00FD93BE-7FD2-42AB-8EF8-B6A8E6CAE0CC (AT) microsoft (DOT) com... Is it possible to pass the function GETDATE() as a SqlParameter? I would like to change: "UPDATE tablename SET [deleted]=1, [date_modified]=GETDATE(), [user_modified]=@user WHERE id=@id" To: "UPDATE tablename SET [deleted]=1, [date_modified]=@currentdatetime, [user_modified]=@user WHERE id=@id" With: sqlp(1) = New System.Data.SqlClient.SqlParameter("@currentdateti me", "GETDATE()") |
#3
| |||
| |||
|
|
Thanks for the response Ekrem. I had considered that as a solution but I would like to ensure that date/time is accurate by using the date/time of the server. I don't have control of all the clients environment so it's possible for the client date/time to be incorrect or in a different time zone. |
![]() |
| Thread Tools | |
| Display Modes | |
| |