Datastore identity column problem

Hi, I have a datastore that contains a datawindow that has
an
identity column and after I update the datastore I want to
get
the value of that column to assign it to the detail table. I
have tried directly and with the getitemnumber function and
it returns
null. I checked the update function return value and is 1
(Ok)
Do we have a problem with the datastore or maybe this doesnt
work with datastore.
Your comments are welcome to help me in this situation
Angel
0
AngelI
12/17/2010 9:37:09 PM
📁 sybase.powerbuilder.datawindow
📃 28057 articles.
⭐ 5 followers.

💬 11 Replies
👁️‍🗨️ 1494 Views


Hi Angel;
    Can you tell us ...
1) Version of PB
2) Your DBMS & version
3) How are you connecting to the DBMS
4) Is this an Insert operation?
5) Does the table have a Trigger on it?
6) Is the identity column marked as AutoSeq or AutoIncrement?
7) Have you tried using a ReSelectRow ( ) function after the update?
Regards ... Chris
President: OSUG / STD Inc.
Blog: http://chrispollach.blogspot.com
PBDJ: http://chrispollach.sys-con.com
SourceForge: http://sourceforge.net/projects/stdfndclass
"AngelI" wrote in message news:4d0bd805.14f.1681692777@sybase.com... 
Hi, I have a datastore that contains a datawindow that has
an
identity column and after I update the datastore I want to
get
the value of that column to assign it to the detail table. I
have tried directly and with the getitemnumber function and
it returns
null. I checked the update function return value and is 1
(Ok)
Do we have a problem with the datastore or maybe this doesnt
work with datastore.
Your comments are welcome to help me in this situation
Angel
0
Chris
12/17/2010 11:24:42 PM
> Hi Angel;
>
>     Can you tell us ...
>
> 1) Version of PB
I am using PB 11.5.1
> 2) Your DBMS & version
I am using SQL Server 2005 SP1
> 3) How are you connecting to the DBMS
SNC
> 4) Is this an Insert operation?
Yes is an Insert
> 5) Does the table have a Trigger on it?
No Trigger
> 6) Is the identity column marked as AutoSeq or
> AutoIncrement?
Autoincrement
7) Have you tried using a ReSelectRow ( )
> function after the update?
Not possible with PB11.5.1
>
> Regards ... Chris
> President: OSUG / STD Inc.
> Blog: http://chrispollach.blogspot.com
> PBDJ: http://chrispollach.sys-con.com
> SourceForge: http://sourceforge.net/projects/stdfndclass
>
> "AngelI" wrote in message
> news:4d0bd805.14f.1681692777@sybase.com...
>
> Hi, I have a datastore that contains a datawindow that has
> an
> identity column and after I update the datastore I want to
> get
> the value of that column to assign it to the detail table.
> I have tried directly and with the getitemnumber function
> and it returns
> null. I checked the update function return value and is 1
> (Ok)
>
> Do we have a problem with the datastore or maybe this
> doesnt work with datastore.
>
> Your comments are welcome to help me in this situation
>
> Angel
0
AngelI
12/20/2010 4:19:23 PM
The table obviously has the identity property set on the column. Does 
the datawindow also have the column marked as an identity column? 
(Bottom of the Update Properties screen.)
You could try tracing your database connection to make sure that PB is 
actually trying to get the value back from the db. Add "TRACE " to the 
beginning of your SQLCA.DBMS setting, like "TRACE ODBC" or "TRACE OLEDB" 
or "TRACE whatever".


On 12/20/2010 10:19 AM, AngelI wrote:
>> Hi Angel;
>>
>>      Can you tell us ...
>>
>> 1) Version of PB
> I am using PB 11.5.1
>> 2) Your DBMS&  version
> I am using SQL Server 2005 SP1
>> 3) How are you connecting to the DBMS
> SNC
>> 4) Is this an Insert operation?
> Yes is an Insert
>> 5) Does the table have a Trigger on it?
> No Trigger
>> 6) Is the identity column marked as AutoSeq or
>> AutoIncrement?
> Autoincrement
> 7) Have you tried using a ReSelectRow ( )
>> function after the update?
> Not possible with PB11.5.1
>>
>> Regards ... Chris
>> President: OSUG / STD Inc.
>> Blog: http://chrispollach.blogspot.com
>> PBDJ: http://chrispollach.sys-con.com
>> SourceForge: http://sourceforge.net/projects/stdfndclass
>>
>> "AngelI" wrote in message
>> news:4d0bd805.14f.1681692777@sybase.com...
>>
>> Hi, I have a datastore that contains a datawindow that has
>> an
>> identity column and after I update the datastore I want to
>> get
>> the value of that column to assign it to the detail table.
>> I have tried directly and with the getitemnumber function
>> and it returns
>> null. I checked the update function return value and is 1
>> (Ok)
>>
>> Do we have a problem with the datastore or maybe this
>> doesnt work with datastore.
>>
>> Your comments are welcome to help me in this situation
>>
>> Angel
0
Jason
12/20/2010 4:39:24 PM
The column is marked as identity in the Update properties.
I did made the trace and it is not trying to get the value
from the database.
(7971818): INSERT INTO Movimiento_Almacen_H ( Prefijo,
Fecha, Almacen_Entrada, Razon, Autor, Estatus_Documento )
VALUES ( 2010, '2010-12-20 15:59:14.347', 12, 'Reposici=f3n
Almac=e9n. Salida: 2. Entrada: 12', 208, 'A' ) (6.181 MS /
942.195 MS)
(7971818): EXECUTE: (0.001 MS / 942.196 MS)
(7971818): *** ERROR 2812 ***(rc -1) : SQLSTATE =3d 42000
Microsoft SQL Native Client
Could not find stored procedure 'ib_disableclosequery'.
(7971818): PREPARE:
(7971818):   SELECT  Almacen.Almacen_ID ,          
Almacen.almacen_descripcion     FROM Almacen   ORDER BY
Almacen.almacen_descripcion          ASC   (4.121 MS /
946.317 MS)
(7971818): BIND SELECT OUTPUT BUFFER (DataWindow): (0.009 MS
/ 946.326 MS)
(7971818):
,len=3d80,type=3dLONG,pbt=3d22,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
(7971818):
,len=3d41,type=3dCHAR,pbt=3d1,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
(7971818): EXECUTE: (0.000 MS / 946.326 MS)
(7971818): FETCH NEXT: (0.041 MS / 946.367 MS)
(7971818):      COLUMN=3d2      COLUMN=3dEspa=f1a #26
(7971818): FETCH NEXT: (0.002 MS / 946.369 MS)
(7971818):      COLUMN=3d7      COLUMN=3dGurabo #1
(7971818): FETCH NEXT: (0.002 MS / 946.371 MS)
(7971818):      COLUMN=3d9      COLUMN=3dGurabo #2
(7971818): FETCH NEXT: (0.001 MS / 946.372 MS)
(7971818):      COLUMN=3d12     COLUMN=3dImbert
(7971818): FETCH NEXT: (0.002 MS / 946.374 MS)
(7971818):      COLUMN=3d11     COLUMN=3dMakita Sto Dgo
(7971818): FETCH NEXT: (0.002 MS / 946.376 MS)
(7971818):      COLUMN=3d8      COLUMN=3dMaterial Gastable
(7971818): FETCH NEXT: (0.002 MS / 946.378 MS)
(7971818):      COLUMN=3d10     COLUMN=3dPontezuela
(7971818): FETCH NEXT: (0.002 MS / 946.380 MS)
(7971818):      COLUMN=3d1      COLUMN=3dPrincipal
(7971818): FETCH NEXT: (0.002 MS / 946.382 MS)
(7971818):      COLUMN=3d6      COLUMN=3dRecepcion Mercancias
(7971818): FETCH NEXT: (0.004 MS / 946.386 MS)
(7971818):      COLUMN=3d5      COLUMN=3dTercera Planta
(7971818): FETCH NEXT: (0.005 MS / 946.391 MS)
(7971818):      COLUMN=3d99     COLUMN=3dTransito
(7971818): FETCH NEXT: (0.038 MS / 946.429 MS)
(7971818): *** DBI_FETCHEND *** (rc 100)
(7971818): PREPARE:
(7971818): INSERT INTO Movimiento_Almacen_D ( Cantidad,
Articulo_ID, Almacen_Salida, Movido ) VALUES ( 1.0000,
42608, 2, 0 ) (6.399 MS / 952.828 MS)
(7971818): *** ERROR 515 ***(rc -1) : SQLSTATE =3d 23000
Microsoft SQL Native Client
Cannot insert the value NULL into column 'MA_ID', table
'Bellon.dbo.Movimiento_Almacen_D'; column does not allow
nulls. INSERT fails.
> The table obviously has the identity property set on the
> column. Does  the datawindow also have the column marked
> as an identity column?  (Bottom of the Update Properties
> screen.)
>
> You could try tracing your database connection to make
> sure that PB is  actually trying to get the value back
> from the db. Add "TRACE " to the  beginning of your
> SQLCA.DBMS setting, like "TRACE ODBC" or "TRACE OLEDB"  or
> "TRACE whatever".
>
>
>
>
> On 12/20/2010 10:19 AM, AngelI wrote:
> >> Hi Angel;
> >>
> >>      Can you tell us ...
> >>
> >> 1) Version of PB
> > I am using PB 11.5.1
> >> 2) Your DBMS&  version
> > I am using SQL Server 2005 SP1
> >> 3) How are you connecting to the DBMS
> > SNC
> >> 4) Is this an Insert operation?
> > Yes is an Insert
> >> 5) Does the table have a Trigger on it?
> > No Trigger
> >> 6) Is the identity column marked as AutoSeq or
> >> AutoIncrement?
> > Autoincrement
> > 7) Have you tried using a ReSelectRow ( )
> >> function after the update?
> > Not possible with PB11.5.1
> >>
> >> Regards ... Chris
> >> President: OSUG / STD Inc.
> >> Blog: http://chrispollach.blogspot.com
> >> PBDJ: http://chrispollach.sys-con.com
> >> SourceForge:
> http://sourceforge.net/projects/stdfndclass >>
> >> "AngelI" wrote in message
> >> news:4d0bd805.14f.1681692777@sybase.com...
> >>
> >> Hi, I have a datastore that contains a datawindow that
> has >> an
> >> identity column and after I update the datastore I want
> to >> get
> >> the value of that column to assign it to the detail
> table. >> I have tried directly and with the getitemnumber
> function >> and it returns
> >> null. I checked the update function return value and is
> 1 >> (Ok)
> >>
> >> Do we have a problem with the datastore or maybe this
> >> doesnt work with datastore.
> >>
> >> Your comments are welcome to help me in this situation
> >>
> >> Angel
0
AngelI
12/20/2010 8:10:37 PM
I see two INSERT statements in your trace file. Both statements show 
that they failed. If the row didn't get inserted, then no identity value 
would have been generated.
For your insert into Movimiento_Almacen_H, you need to see why it's 
trying to access a stored procedure called 'ib_disableclosequery'. That 
looks like a PB variable name. Did you forget a colon(:)?
For your insert into Movimiento_Almacen_D, it's complaining about a NULL 
value for MA_ID. Is that supposed to be the identity value from the 
first insert? If not, then that's a second thing you might need to look 
into. (I don't even see that column listed in the insert statement.)

On 12/20/2010 2:10 PM, AngelI wrote:
> The column is marked as identity in the Update properties.
>
> I did made the trace and it is not trying to get the value
> from the database.
>
> (7971818): INSERT INTO Movimiento_Almacen_H ( Prefijo,
> Fecha, Almacen_Entrada, Razon, Autor, Estatus_Documento )
> VALUES ( 2010, '2010-12-20 15:59:14.347', 12, 'Reposici�n
> Almac�n. Salida: 2. Entrada: 12', 208, 'A' ) (6.181 MS /
> 942.195 MS)
> (7971818): EXECUTE: (0.001 MS / 942.196 MS)
> (7971818): *** ERROR 2812 ***(rc -1) : SQLSTATE = 42000
> Microsoft SQL Native Client
> Could not find stored procedure 'ib_disableclosequery'.
> (7971818): PREPARE:
> (7971818):   SELECT  Almacen.Almacen_ID ,
> Almacen.almacen_descripcion     FROM Almacen   ORDER BY
> Almacen.almacen_descripcion          ASC   (4.121 MS /
> 946.317 MS)
> (7971818): BIND SELECT OUTPUT BUFFER (DataWindow): (0.009 MS
> / 946.326 MS)
> (7971818):
> ,len=80,type=LONG,pbt=22,dbt=0,ct=0,prec=0,scale=0
> (7971818):
> ,len=41,type=CHAR,pbt=1,dbt=0,ct=0,prec=0,scale=0
> (7971818): EXECUTE: (0.000 MS / 946.326 MS)
> (7971818): FETCH NEXT: (0.041 MS / 946.367 MS)
> (7971818):         COLUMN=2        COLUMN=Espa�a #26
> (7971818): FETCH NEXT: (0.002 MS / 946.369 MS)
> (7971818):         COLUMN=7        COLUMN=Gurabo #1
> (7971818): FETCH NEXT: (0.002 MS / 946.371 MS)
> (7971818):         COLUMN=9        COLUMN=Gurabo #2
> (7971818): FETCH NEXT: (0.001 MS / 946.372 MS)
> (7971818):         COLUMN=12       COLUMN=Imbert
> (7971818): FETCH NEXT: (0.002 MS / 946.374 MS)
> (7971818):         COLUMN=11       COLUMN=Makita Sto Dgo
> (7971818): FETCH NEXT: (0.002 MS / 946.376 MS)
> (7971818):         COLUMN=8        COLUMN=Material Gastable
> (7971818): FETCH NEXT: (0.002 MS / 946.378 MS)
> (7971818):         COLUMN=10       COLUMN=Pontezuela
> (7971818): FETCH NEXT: (0.002 MS / 946.380 MS)
> (7971818):         COLUMN=1        COLUMN=Principal
> (7971818): FETCH NEXT: (0.002 MS / 946.382 MS)
> (7971818):         COLUMN=6        COLUMN=Recepcion Mercancias
> (7971818): FETCH NEXT: (0.004 MS / 946.386 MS)
> (7971818):         COLUMN=5        COLUMN=Tercera Planta
> (7971818): FETCH NEXT: (0.005 MS / 946.391 MS)
> (7971818):         COLUMN=99       COLUMN=Transito
> (7971818): FETCH NEXT: (0.038 MS / 946.429 MS)
> (7971818): *** DBI_FETCHEND *** (rc 100)
> (7971818): PREPARE:
> (7971818): INSERT INTO Movimiento_Almacen_D ( Cantidad,
> Articulo_ID, Almacen_Salida, Movido ) VALUES ( 1.0000,
> 42608, 2, 0 ) (6.399 MS / 952.828 MS)
> (7971818): *** ERROR 515 ***(rc -1) : SQLSTATE = 23000
> Microsoft SQL Native Client
> Cannot insert the value NULL into column 'MA_ID', table
> 'Bellon.dbo.Movimiento_Almacen_D'; column does not allow
> nulls. INSERT fails.
>
>> The table obviously has the identity property set on the
>> column. Does  the datawindow also have the column marked
>> as an identity column?  (Bottom of the Update Properties
>> screen.)
>>
>> You could try tracing your database connection to make
>> sure that PB is  actually trying to get the value back
>> from the db. Add "TRACE " to the  beginning of your
>> SQLCA.DBMS setting, like "TRACE ODBC" or "TRACE OLEDB"  or
>> "TRACE whatever".
>>
>>
>>
>>
>> On 12/20/2010 10:19 AM, AngelI wrote:
>>>> Hi Angel;
>>>>
>>>>       Can you tell us ...
>>>>
>>>> 1) Version of PB
>>> I am using PB 11.5.1
>>>> 2) Your DBMS&   version
>>> I am using SQL Server 2005 SP1
>>>> 3) How are you connecting to the DBMS
>>> SNC
>>>> 4) Is this an Insert operation?
>>> Yes is an Insert
>>>> 5) Does the table have a Trigger on it?
>>> No Trigger
>>>> 6) Is the identity column marked as AutoSeq or
>>>> AutoIncrement?
>>> Autoincrement
>>> 7) Have you tried using a ReSelectRow ( )
>>>> function after the update?
>>> Not possible with PB11.5.1
>>>>
>>>> Regards ... Chris
>>>> President: OSUG / STD Inc.
>>>> Blog: http://chrispollach.blogspot.com
>>>> PBDJ: http://chrispollach.sys-con.com
>>>> SourceForge:
>> http://sourceforge.net/projects/stdfndclass>>
>>>> "AngelI" wrote in message
>>>> news:4d0bd805.14f.1681692777@sybase.com...
>>>>
>>>> Hi, I have a datastore that contains a datawindow that
>> has>>  an
>>>> identity column and after I update the datastore I want
>> to>>  get
>>>> the value of that column to assign it to the detail
>> table.>>  I have tried directly and with the getitemnumber
>> function>>  and it returns
>>>> null. I checked the update function return value and is
>> 1>>  (Ok)
>>>>
>>>> Do we have a problem with the datastore or maybe this
>>>> doesnt work with datastore.
>>>>
>>>> Your comments are welcome to help me in this situation
>>>>
>>>> Angel
0
Jason
12/20/2010 8:26:52 PM
To add to Jason's response.
It appears that the two errors have escaped your attention - which indicates 
that you are using a standard datastore which has no code in the dberror 
event.  This means that all errors are escaping your application without 
detection.  You will need to add your own error-checking/handling code for 
this to be successful. 

0
Scott
12/20/2010 8:51:20 PM
I just put the code of the header table to update. It
updates correct and it saves it to the DB, but even after
the commit I get a null value when I try to get the identity
column.
This has never happened to me
> The column is marked as identity in the Update properties.
>
> I did made the trace and it is not trying to get the value
> from the database.
>
> (7971818): INSERT INTO Movimiento_Almacen_H ( Prefijo,
> Fecha, Almacen_Entrada, Razon, Autor, Estatus_Documento )
> VALUES ( 2010, '2010-12-20 15:59:14.347', 12,
'Reposici=f3n
> Almac=e9n. Salida: 2. Entrada: 12', 208, 'A' ) (6.181 MS /
> 942.195 MS)
> (7971818): EXECUTE: (0.001 MS / 942.196 MS)
> (7971818): *** ERROR 2812 ***(rc -1) : SQLSTATE =3d 42000
> Microsoft SQL Native Client
> Could not find stored procedure 'ib_disableclosequery'.
> (7971818): PREPARE:
> (7971818):   SELECT  Almacen.Almacen_ID ,
> Almacen.almacen_descripcion     FROM Almacen   ORDER BY
> Almacen.almacen_descripcion          ASC   (4.121 MS /
> 946.317 MS)
> (7971818): BIND SELECT OUTPUT BUFFER (DataWindow): (0.009
> MS / 946.326 MS)
> (7971818):
>
,len=3d80,type=3dLONG,pbt=3d22,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
> (7971818):
>
,len=3d41,type=3dCHAR,pbt=3d1,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
> (7971818): EXECUTE: (0.000 MS / 946.326 MS)
> (7971818): FETCH NEXT: (0.041 MS / 946.367 MS)
> (7971818):     COLUMN=3d2    COLUMN=3dEspa=f1a #26
> (7971818): FETCH NEXT: (0.002 MS / 946.369 MS)
> (7971818):     COLUMN=3d7    COLUMN=3dGurabo #1
> (7971818): FETCH NEXT: (0.002 MS / 946.371 MS)
> (7971818):     COLUMN=3d9    COLUMN=3dGurabo #2
> (7971818): FETCH NEXT: (0.001 MS / 946.372 MS)
> (7971818):     COLUMN=3d12    COLUMN=3dImbert
> (7971818): FETCH NEXT: (0.002 MS / 946.374 MS)
> (7971818):     COLUMN=3d11    COLUMN=3dMakita Sto Dgo
> (7971818): FETCH NEXT: (0.002 MS / 946.376 MS)
> (7971818):     COLUMN=3d8    COLUMN=3dMaterial Gastable
> (7971818): FETCH NEXT: (0.002 MS / 946.378 MS)
> (7971818):     COLUMN=3d10    COLUMN=3dPontezuela
> (7971818): FETCH NEXT: (0.002 MS / 946.380 MS)
> (7971818):     COLUMN=3d1    COLUMN=3dPrincipal
> (7971818): FETCH NEXT: (0.002 MS / 946.382 MS)
> (7971818):     COLUMN=3d6    COLUMN=3dRecepcion Mercancias
> (7971818): FETCH NEXT: (0.004 MS / 946.386 MS)
> (7971818):     COLUMN=3d5    COLUMN=3dTercera Planta
> (7971818): FETCH NEXT: (0.005 MS / 946.391 MS)
> (7971818):     COLUMN=3d99    COLUMN=3dTransito
> (7971818): FETCH NEXT: (0.038 MS / 946.429 MS)
> (7971818): *** DBI_FETCHEND *** (rc 100)
> (7971818): PREPARE:
> (7971818): INSERT INTO Movimiento_Almacen_D ( Cantidad,
> Articulo_ID, Almacen_Salida, Movido ) VALUES ( 1.0000,
> 42608, 2, 0 ) (6.399 MS / 952.828 MS)
> (7971818): *** ERROR 515 ***(rc -1) : SQLSTATE =3d 23000
> Microsoft SQL Native Client
> Cannot insert the value NULL into column 'MA_ID', table
> 'Bellon.dbo.Movimiento_Almacen_D'; column does not allow
> nulls. INSERT fails.
>
> > The table obviously has the identity property set on the
> > column. Does  the datawindow also have the column marked
> > as an identity column?  (Bottom of the Update Properties
> > screen.)
> >
> > You could try tracing your database connection to make
> > sure that PB is  actually trying to get the value back
> > from the db. Add "TRACE " to the  beginning of your
> > SQLCA.DBMS setting, like "TRACE ODBC" or "TRACE OLEDB"
> > or "TRACE whatever".
> >
> >
> >
> >
> > On 12/20/2010 10:19 AM, AngelI wrote:
> > >> Hi Angel;
> > >>
> > >>      Can you tell us ...
> > >>
> > >> 1) Version of PB
> > > I am using PB 11.5.1
> > >> 2) Your DBMS&  version
> > > I am using SQL Server 2005 SP1
> > >> 3) How are you connecting to the DBMS
> > > SNC
> > >> 4) Is this an Insert operation?
> > > Yes is an Insert
> > >> 5) Does the table have a Trigger on it?
> > > No Trigger
> > >> 6) Is the identity column marked as AutoSeq or
> > >> AutoIncrement?
> > > Autoincrement
> > > 7) Have you tried using a ReSelectRow ( )
> > >> function after the update?
> > > Not possible with PB11.5.1
> > >>
> > >> Regards ... Chris
> > >> President: OSUG / STD Inc.
> > >> Blog: http://chrispollach.blogspot.com
> > >> PBDJ: http://chrispollach.sys-con.com
> > >> SourceForge:
> > http://sourceforge.net/projects/stdfndclass >>
> > >> "AngelI" wrote in message
> > >> news:4d0bd805.14f.1681692777@sybase.com...
> > >>
> > >> Hi, I have a datastore that contains a datawindow
> > that has >> an
> > >> identity column and after I update the datastore I
> > want to >> get
> > >> the value of that column to assign it to the detail
> > table. >> I have tried directly and with the
> > getitemnumber function >> and it returns
> > >> null. I checked the update function return value and
> > is 1 >> (Ok)
> > >>
> > >> Do we have a problem with the datastore or maybe this
> > >> doesnt work with datastore.
> > >>
> > >> Your comments are welcome to help me in this
> > situation >>
> > >> Angel
0
AngelI
12/21/2010 10:18:05 PM
<AngelI> wrote in message news:4d11279d.30f.1681692777@sybase.com...
>I just put the code of the header table to update. It
>updates correct and it saves it to the DB, but even after
>the commit I get a null value when I try to get the identity
>column.
>
>This has never happened to me
At this point, there isn't enough useful information to make any further 
suggestions.  I did notice an error in the trace you posted ("(7971818): *** 
ERROR 2812 ***(rc -1) : SQLSTATE = 42000 Microsoft SQL Native Client Could 
not find stored procedure 'ib_disableclosequery'.") that seems to indicate 
some issues with the values you have set for your transaction object (or 
perhaps some code that is attempting to override standard PB update 
behavior).
If you are new to the SNC interface or the version of PB that you are using, 
it would be helpful to know that and as well as the version/interface you 
previously used.  It would also help to see the actual values you use to 
populate your transaction object before connecting to the database.
Lastly, you might find it helpful to the the MS Profiler tool that comes 
with SQL Server. 

0
Scott
12/22/2010 2:00:17 PM
I did a test compiling the project and running the app and
for
my surprise it worked correctly.
I think the problem is in runtime mode and I have the latest
EBF.
At last I figured out what happened.
Thanks for all your help
> I just put the code of the header table to update. It
> updates correct and it saves it to the DB, but even after
> the commit I get a null value when I try to get the
> identity column.
>
> This has never happened to me
>
> > The column is marked as identity in the Update
> properties. >
> > I did made the trace and it is not trying to get the
> > value from the database.
> >
> > (7971818): INSERT INTO Movimiento_Almacen_H ( Prefijo,
> > Fecha, Almacen_Entrada, Razon, Autor, Estatus_Documento
> > ) VALUES ( 2010, '2010-12-20 15:59:14.347', 12,
> 'Reposici=f3n
> > Almac=e9n. Salida: 2. Entrada: 12', 208, 'A' ) (6.181 MS
/
> > 942.195 MS)
> > (7971818): EXECUTE: (0.001 MS / 942.196 MS)
> > (7971818): *** ERROR 2812 ***(rc -1) : SQLSTATE =3d
42000
> > Microsoft SQL Native Client
> > Could not find stored procedure 'ib_disableclosequery'.
> > (7971818): PREPARE:
> > (7971818):   SELECT  Almacen.Almacen_ID ,
> > Almacen.almacen_descripcion     FROM Almacen   ORDER BY
> > Almacen.almacen_descripcion          ASC   (4.121 MS /
> > 946.317 MS)
> > (7971818): BIND SELECT OUTPUT BUFFER (DataWindow):
> > (0.009 MS / 946.326 MS)
> > (7971818):
> >
>
,len=3d80,type=3dLONG,pbt=3d22,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
> > (7971818):
> >
>
,len=3d41,type=3dCHAR,pbt=3d1,dbt=3d0,ct=3d0,prec=3d0,scale=3d0
> > (7971818): EXECUTE: (0.000 MS / 946.326 MS)
> > (7971818): FETCH NEXT: (0.041 MS / 946.367 MS)
> > (7971818):     COLUMN=3d2    COLUMN=3dEspa=f1a #26
> > (7971818): FETCH NEXT: (0.002 MS / 946.369 MS)
> > (7971818):     COLUMN=3d7    COLUMN=3dGurabo #1
> > (7971818): FETCH NEXT: (0.002 MS / 946.371 MS)
> > (7971818):     COLUMN=3d9    COLUMN=3dGurabo #2
> > (7971818): FETCH NEXT: (0.001 MS / 946.372 MS)
> > (7971818):     COLUMN=3d12    COLUMN=3dImbert
> > (7971818): FETCH NEXT: (0.002 MS / 946.374 MS)
> > (7971818):     COLUMN=3d11    COLUMN=3dMakita Sto Dgo
> > (7971818): FETCH NEXT: (0.002 MS / 946.376 MS)
> > (7971818):     COLUMN=3d8    COLUMN=3dMaterial Gastable
> > (7971818): FETCH NEXT: (0.002 MS / 946.378 MS)
> > (7971818):     COLUMN=3d10    COLUMN=3dPontezuela
> > (7971818): FETCH NEXT: (0.002 MS / 946.380 MS)
> > (7971818):     COLUMN=3d1    COLUMN=3dPrincipal
> > (7971818): FETCH NEXT: (0.002 MS / 946.382 MS)
> > (7971818):     COLUMN=3d6    COLUMN=3dRecepcion
Mercancias
> > (7971818): FETCH NEXT: (0.004 MS / 946.386 MS)
> > (7971818):     COLUMN=3d5    COLUMN=3dTercera Planta
> > (7971818): FETCH NEXT: (0.005 MS / 946.391 MS)
> > (7971818):     COLUMN=3d99    COLUMN=3dTransito
> > (7971818): FETCH NEXT: (0.038 MS / 946.429 MS)
> > (7971818): *** DBI_FETCHEND *** (rc 100)
> > (7971818): PREPARE:
> > (7971818): INSERT INTO Movimiento_Almacen_D ( Cantidad,
> > Articulo_ID, Almacen_Salida, Movido ) VALUES ( 1.0000,
> > 42608, 2, 0 ) (6.399 MS / 952.828 MS)
> > (7971818): *** ERROR 515 ***(rc -1) : SQLSTATE =3d 23000
> > Microsoft SQL Native Client
> > Cannot insert the value NULL into column 'MA_ID', table
> > 'Bellon.dbo.Movimiento_Almacen_D'; column does not allow
> > nulls. INSERT fails.
> >
> > > The table obviously has the identity property set on
> > > the column. Does  the datawindow also have the column
> > > marked as an identity column?  (Bottom of the Update
> > > Properties screen.)
> > >
> > > You could try tracing your database connection to make
> > > sure that PB is  actually trying to get the value back
> > > from the db. Add "TRACE " to the  beginning of your
> > > SQLCA.DBMS setting, like "TRACE ODBC" or "TRACE OLEDB"
> > > or "TRACE whatever".
> > >
> > >
> > >
> > >
> > > On 12/20/2010 10:19 AM, AngelI wrote:
> > > >> Hi Angel;
> > > >>
> > > >>      Can you tell us ...
> > > >>
> > > >> 1) Version of PB
> > > > I am using PB 11.5.1
> > > >> 2) Your DBMS&  version
> > > > I am using SQL Server 2005 SP1
> > > >> 3) How are you connecting to the DBMS
> > > > SNC
> > > >> 4) Is this an Insert operation?
> > > > Yes is an Insert
> > > >> 5) Does the table have a Trigger on it?
> > > > No Trigger
> > > >> 6) Is the identity column marked as AutoSeq or
> > > >> AutoIncrement?
> > > > Autoincrement
> > > > 7) Have you tried using a ReSelectRow ( )
> > > >> function after the update?
> > > > Not possible with PB11.5.1
> > > >>
> > > >> Regards ... Chris
> > > >> President: OSUG / STD Inc.
> > > >> Blog: http://chrispollach.blogspot.com
> > > >> PBDJ: http://chrispollach.sys-con.com
> > > >> SourceForge:
> > > http://sourceforge.net/projects/stdfndclass >>
> > > >> "AngelI" wrote in message
> > > >> news:4d0bd805.14f.1681692777@sybase.com...
> > > >>
> > > >> Hi, I have a datastore that contains a datawindow
> > > that has >> an
> > > >> identity column and after I update the datastore I
> > > want to >> get
> > > >> the value of that column to assign it to the detail
> > > table. >> I have tried directly and with the
> > > getitemnumber function >> and it returns
> > > >> null. I checked the update function return value
> > > and is 1 >> (Ok)
> > > >>
> > > >> Do we have a problem with the datastore or maybe
> > > this >> doesnt work with datastore.
> > > >>
> > > >> Your comments are welcome to help me in this
> > > situation >>
> > > >> Angel
0
AngelI
12/23/2010 3:55:00 PM
On 18/12/2010 8:37 AM, AngelI wrote:
> Hi, I have a datastore that contains a datawindow that has
> an
> identity column and after I update the datastore I want to
> get
> the value of that column to assign it to the detail table. I
> have tried directly and with the getitemnumber function and
> it returns
> null. I checked the update function return value and is 1
> (Ok)
>
> Do we have a problem with the datastore or maybe this doesnt
> work with datastore.
>
> Your comments are welcome to help me in this situation
>
> Angel
May not be the issue but in the past I have had to put this in the 
dbparm connection property for identity column values to return 
correctly (using SQL Server).
Identity='SCOPE_IDENTITY()'


0
Adam
12/29/2010 3:39:42 AM
On 29/12/2010 2:39 PM, Adam Simmonds wrote:
> On 18/12/2010 8:37 AM, AngelI wrote:
>> Hi, I have a datastore that contains a datawindow that has
>> an
>> identity column and after I update the datastore I want to
>> get
>> the value of that column to assign it to the detail table. I
>> have tried directly and with the getitemnumber function and
>> it returns
>> null. I checked the update function return value and is 1
>> (Ok)
>>
>> Do we have a problem with the datastore or maybe this doesnt
>> work with datastore.
>>
>> Your comments are welcome to help me in this situation
>>
>> Angel
>
> May not be the issue but in the past I have had to put this in the
> dbparm connection property for identity column values to return
> correctly (using SQL Server).
>
> Identity='SCOPE_IDENTITY()'
I just had a play with this and if I exclude the DbParm option the 
identity value is not returned after an update.
When I include it the identity value is returned correctly immediately 
after the update and does not require a re-retrieve or reselectrow.

0
Adam
12/29/2010 3:50:03 AM
Reply: