VoiceGuide IVR Software Main Page
Jump to content

Syntax Problem

Recommended Posts

I am trying to update an SQL database with a date / time and I'm struggling to work out the correct syntax.

 

I have two RV's which I am using to set 2 temporary variables :

 

Tmp_Duration=$RV[MAX_DURATION]

Tmp_Start=$RV[HOURLY_START]

 

I am then using these to calculate the date / time I need to write to the database :

 

Stop_Date=DateAdd("h",Tmp_Duration,Tmp_Start)

 

I then build the string which I use to update the SQL database :

 

sSQL = "UPDATE TransactionMaster SET dtstop=" & Stop_Date & " , TransactionStatus='p' where Transcode=" & "'$RV[Ask_Veri_Number]'"

 

cn.execute sSQL

 

This gives an error and I have tried to change the sSQL string but I keep getting errors. If I use :

 

sSQL = "UPDATE TransactionMaster SET dtstop=" & "6/6/07 12:34:00" & " , TransactionStatus='p' where Transcode=" & "'$RV[Ask_Veri_Number]'"

 

It seems to work fine, but I cant seem to get Stop_Date into the string without getting an error. (Either I get syntax error or expected end of statement error)

 

Any clues?

 

 

 

 

Share this post


Link to post
I cant seem to get Stop_Date into the string without getting an error.(Either I get syntax error or expected end of statement error)

Sounds like the VBScript's DateAdd function dose not assign a value to Stop_Date which is in the same format as expected by your databases's SQL processor.

 

Have you tried printing out the Stop_Date variable to see in what format the date string is stored in that variable?

 

You may need to further reformat the date string before feeding it as input into the SQL command.

 

Strictly speaking this is a VBScript related question rather then a VoiceGuide related question.

 

Share this post


Link to post

FluffyBunny: Can I suggest you get a VBS editor/debugger, it helps enornously when solving this sort of problem, as you can interactively debug the VG VBS without running VG. I suggest you take a look at VBSEdit (recommended elsewhere by katalina) at http://www.adersoft.com/ as it does all you want for about $50. Then you can step thri your code and get the date-stamp right.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×