asp.net - UpdateParameters with datetime -


i trying use sqldatasource.updateparameters.add() add date/time database table. column data type smalldatetime , displaying in gridview fine. if try end edit date/time, save changes other fields update, date/time remains same. have tried using datetime.parse methods no success.

sqlds1.updateparameters.add("measurementdatetime", data.dbtype.datetime, currentmsrmntdatetime.text) 

i use above code each respective value , parameter pair, date/time field doesn't update. update statement again works parameters except date/time.

 create procedure [dbo].[updatecathodetemps] (     @measurementtypecode int     ,@measurementdatetime smalldatetime     ,@value nvarchar(50)     ,@comments nvarchar(512)     ,@ismeasurementchecked bit     ,@measurementcheckedby nvarchar(50)     ,@bakedetailsid int     -- 7 params )    begin transaction  update tblmeasurementsatperiod set measurementdatetime =  @measurementdatetime,  value = @value,  comments = @comments,  measurementcheckedby = @measurementcheckedby,  ismeasurementchecked = @ismeasurementchecked,  measurementtypecode = @measurementtypecode,  bakedetailsid = @bakedetailsid   measurementdatetime = @measurementdatetime , measurementtypecode = @measurementtypecode   if @@error <> 0 begin     rollback     return end    commit 

no errors thrown when hit save button, other fields updated, date/time remains same. have checked values being passed stored procedure, , expect.

here's problem in where clause of stored procedure:

where measurementdatetime = @measurementdatetime ,        measurementtypecode = @measurementtypecode 

so updating exact same date!

the clause picks rows given measurementdatetime, update rows measurementdatetime updating same (obviously).

perhaps want 2 params:

,@originalmeasurementdatetime smalldatetime ,@newmeasurementdatetime smalldatetime 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -