|
-
August 4th, 2009, 04:56 AM
#1
Visual basic and sql
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
-
August 4th, 2009, 06:12 AM
#2
Re: Visual basic and sql
Do you see any differences in the immediate window if you ask the value of SQL_Insert ?
-
August 4th, 2009, 07:43 AM
#3
Re: Visual basic and sql
Try to debug.print your SQL_insert string and check if it results in exactly the same as you entered manually.
-
August 4th, 2009, 07:47 AM
#4
Re: Visual basic and sql
Might also help if you told us what the error is that you are receiving
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|