Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kaus
Posting Yak Master
179 Posts |
Posted - 2001-07-13 : 18:33:10
|
| Hi - I'm getting syntax error converting datetime from character string whenever I try updating a date value in my database via a stored procedure called from an ASP page. Below is the relevant code both on ASP and the stored procedure. I've tested the imput on the ASP side with IsDate and it shows as being a date -- any ideas ?? -- I've also tried using "/" as date separator and using datetime as the datatype on both ASP parameter and in stored procedure -- also tried surrounding string with #'GET VALUES FROM FORM -- ASP PAGE if request("ContractMonth") <> "" then ContractDate = request("ContractMonth") & "-" & request("ContractDay") & "-" & request("ContractYear") else ContractDate = "" end if'SET COMMAND PARAMETERS -- ASP PAGESet prm2 = Cmd.CreateParameter ("contract_date", adVarChar, adParamInput, 25) prm2.value = ContractDateCmd.Execute ************** Error occurs here'STORED PROCEDURECREATE procedure sp_update_fund @strID varchar(5),@strContractDate varchar(25)asDECLARE @strsql varchar(2000)DECLARE @strsql1 varchar(100)DECLARE @strsql2 varchar(100)DECLARE @strsql3 varchar(100)SELECT @strsql = 'Update Funding Set 'if @strContractDate = "" BEGIN SELECT @strsql1 = 'Contract_Date = NULL' ENDelse BEGIN SELECT @strsql1 = 'Contract_Date = '' + @strContractDate + ''' ENDSELECT @strsql = @strsql + @strsql1 + ' where Project_ID = ' + @strIDexec (@strsql)--print @strsqlThanks -- Any help greatly appreciated ! |
|
|
|
|
|