简体   繁体   中英

ORA-00917: Missing Comma error in VB

I am having a lot of trouble trying to get some VB code to work in Excel, when trying to write to a DB. I keep getting this comma error, but i cannot for the life of me see where the comma is missing...here is the code...

While Not IsEmpty(startRange.Offset(i, 0))

    tentype = startRange.Offset(i, 0).Value
    tendelivery = "EMAIL"
    tenevent = startRange.Offset(i, 1).Value
    tentext = startRange.Offset(i, 2).Value
    tensubject = startRange.Offset(i, 3).Value
    tentrailer = startRange.Offset(i, 4).Value
    tenlanguage = startRange.Offset(i, 5).Value
    tenid = 10 + i




With objCommand
.ActiveConnection = "Driver={Microsoft ODBC for Oracle};Server=*;Uid=*;Pwd=*"
.CommandText = "INSERT INTO TEN_TEMPLATE VALUES (" & tenid & ", " & tendelivery & ", " & tentype & ", " & tenevent & ", " & tentext & ", " & tenlanguage & ", " & tensubject & ", " & tentrailer & ")"
.Execute

End With

    i = i + 1
Wend

I would greatly appreciate any help.

Thanks, Brett

Could one of your values have an embedded comma or, more likely, a quote? That may screw up the resulting SQL string even though your building looks good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM