I have a vb script that is triggered by an event sink.

My problem is with a sql insert statement.

The script basically strips out an incoming email, reforms it and forwards it on - within the script however im trying to insert the stripped out values into a sql database.

This works fine with certain values im trying to insert however one of the strings im trying to insert is a url i.e http://xxx.xxxcom/xxxx.asp?Id=e1a9e5...0-339faf481c25

The insert fails when this is added as a variable ie

links = "http://xxx.xxxcom/xxxx.asp?Id=e1a9e5da-9929-4616-bb40-339faf481c25"

SQL_Insert = "Insert into MyTable (id, AOI,Inc,Link)" & _
"values (" & id & ",'" & aoistring & "','" & inc & "','" & links & "')"
Set dbRS= cn.Execute(SQL_Insert)

But if it added directly as a string in the insert it is successful ie
SQL_Insert = "Insert into MyTable (id, AOI,Inc,Link)" & _
"values (" & id & ",'" & aoistring & "','" & inc & "','http://xxx.xxxcom/xxxx.asp?Id=e1a9e5da-9929-4616-bb40-339faf481c25')"
Set dbRS= cn.Execute(SQL_Insert)

Can anyone shed any light on this as I am baffled.

The same code works fine using asp and vbscript with variables.

Thanks

Tim
Reply With Quote