Cannot Add Row with Informix OLE DB and ADO
Posted in 1999
Topics: General Discussion
hi, here comes another problem. suppose i've made the connection (in fact not yet :P) thru the informix ole db provider using ado in vb6. i can't add row to a specific table. when i try to insert a row, it prompts me with a message 'syntax error or access violation'. the following are the codes i use: Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset '... Connection made here. With rs .Open "SELECT * FROM tbl", cn, adOpenKeyset, adLockOptimistic .AddNew !field = "ABC" .Update 'Both .Save and .Update cause the same error .Close End With Set rs = Nothing cn.Close Set cn = Nothing that's it! what's wrong with the codes? input are all welcome. :) thanx in advance. rgds, thenard Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
Can you try client-side cursor - server-side cursor with pre-9.2 servers is updatable only if you open it on the table, like rs.Open "tbl", cn, adOpenStatic, adLockOptimistic, adCmdTableDirect Leopold Thenardier <thenardier@zdnetmail.com> wrote in message news:7qoa8l$6jn$1@nnrp1.deja.com... > > > hi, > > here comes another problem. suppose i've made the connection > (in fact not yet :P) thru the informix ole db provider using ado > in vb6. i can't add row to a specific table. when i try to > insert a row, it prompts me with a message 'syntax error or access > violation'. the following are the codes i use: > > Dim cn As New ADODB.Connection > Dim rs As New ADODB.Recordset > > '... Connection made here. > > With rs > .Open "SELECT * FROM tbl", cn, adOpenKeyset, adLockOptimistic > .AddNew > !field = "ABC" > .Update 'Both .Save and .Update cause the same error > .Close > End With > > Set rs = Nothing > cn.Close > Set cn = Nothing > > that's it! what's wrong with the codes? input are all > welcome. :) thanx in advance. > > > rgds, > thenard > > > Sent via Deja.com http://www.deja.com/ > Share what you know. Learn what you don't.