Unable Insert Informix Serial Field with OLE DB & ADO
Posted in 1999
Topics: Security, Permissions & Auditing
hi, it's me again. :) thank you for helping me to connect to and create a recordset in the informox database with its ole db provider (informix client sdk 2.30). here comes another problem. i still cannot insert a record to a table thru ado recordset in vb 6. i suspect it's because of the serial field. here's the code i use. ************************************************** Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim sCnStr As String sCnStr = "Provider=Ifxoledbc.2;Password=pass;" & _ "Persist Security Info=False;User ID=id;" & _ "Data Source=ds@serveri;Connect Timeout=15" With cn .ConnectionString = sCnStr .CursorLocation = adUseServer .Open End With With rs .CursorLocation = adUseServer End With rs.Open "tbl", cn, adOpenDynamic, adLockOptimistic, adCmdTableDirect 'rs successfully opened With rs .AddNew !fld_serial.Value = 0 !fld_char.Value = "ZZZZZ" !fld_date.Value = Date !fld_integer.Value = 999 !fld_decimal.Value = 999.98 !fld_float.Value = 999.9876 !fld_money.Value = 999999.9 !fld_datetime.Value = Now 'Same error occurs when .value is omitted. .Update End With rs.Close Set rs = Nothing cn.Close Set cn = Nothing ************************************************** when i leave the !fld_serial blank, it prompts me "insufficient base table information..."; when i set the !fld_serial = 0, it says "an error occurs..." where does it go wrong? about the serial field? or the date or datetime field has some problem? thank u very much! rgds, thenard Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
Provider does not believe in setting serial fields. Should work if you
remove fld_serial assignment. I did and it worked against NT 9.x server,
table
create table tbl(fld_serial serial, fld_char char(10), fld_date date,
fld_integer int, fld_decimal decimal, fld_float float, fld_money money,fld_datetime datetime year to fraction(5));
Note that provider does not support dynamic cursor, only forward only and
static (client- or server-side).
Leopold
Thenardier <thenardier@zdnetmail.com> wrote in message
news:7qv6hc$pob$1@nnrp1.deja.com...
>
>
> hi, it's me again. :)
>
> thank you for helping me to connect to and create a
> recordset in the informox database with its ole db
> provider (informix client sdk 2.30). here comes another
> problem. i still cannot insert a record to a table thru
> ado recordset in vb 6. i suspect it's because of the
> serial field. here's the code i use.
>
> **************************************************
>
> Dim cn As New ADODB.Connection
> Dim rs As New ADODB.Recordset
>
> Dim sCnStr As String
>
> sCnStr = "Provider=Ifxoledbc.2;Password=pass;" & _
> "Persist Security Info=False;User ID=id;" & _
> "Data Source=ds@serveri;Connect Timeout=15"
>
> With cn
> .ConnectionString = sCnStr
> .CursorLocation = adUseServer
> .Open
> End With
>
> With rs
> .CursorLocation = adUseServer
> End With
>
> rs.Open "tbl", cn, adOpenDynamic, adLockOptimistic, adCmdTableDirect
> 'rs successfully opened
>
> With rs
> .AddNew
> !fld_serial.Value = 0
> !fld_char.Value = "ZZZZZ"
> !fld_date.Value = Date
> !fld_integer.Value = 999
> !fld_decimal.Value = 999.98
> !fld_float.Value = 999.9876
> !fld_money.Value = 999999.9
> !fld_datetime.Value = Now
> 'Same error occurs when .value is omitted.
> .Update
> End With
>
> rs.Close
> Set rs = Nothing
> cn.Close
> Set cn = Nothing
>
> **************************************************
>
> when i leave the !fld_serial blank, it prompts me
> "insufficient base table information..."; when i
> set the !fld_serial = 0, it says "an error occurs..."
>
> where does it go wrong? about the serial field?
> or the date or datetime field has some problem?
>
> thank u very much!
>
>
> rgds,
> thenard
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.