views:

19

answers:

1

i am using sql server for database. In my coding when am inserting integer value into table am getting type mismatch error. my code as

set rst1=cnn1.execute("select distinct(tagid) from pgevent")

it returns some values when am trying to insert into another table am getting error

cnn1.execute("insert into tags values("+cint(rst1.fields(0).value)+")")

now am geting error thanks

+1  A: 

The error is because you are appending a numeric value to a string.

Here are the alternatives

cnn1.execute("insert into tags values(" & cint(rst1.fields(0).value) & ")")

OR

cnn1.execute("insert into tags values("+ rst1.fields(0).value +")")

Use & when you want something to appear as part of the string.

shahkalpesh