muniprasad
muniprasad

Reputation: 1

vb6 run time error 13

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

Upvotes: 0

Views: 672

Answers (1)

shahkalpesh
shahkalpesh

Reputation: 33474

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.

Upvotes: 1

Related Questions