NetTalk Central

Author Topic: Priming MSSQL Identity field  (Read 3818 times)

Neil Porter

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Priming MSSQL Identity field
« on: January 26, 2009, 06:09:18 AM »
I have a netwebform that I'm using to update records from an MSSQL table called "Jobs".

I have a tab that contains a browse showing child records from a table called "JobParcels"

For some reason I have never been able to get the suggested Clarion 6.3 way of getting the parent identity field value to work, even though I have a table option of EmulateAutoNumKey = True and AutoNumber = 1,1 and IsIdentity = True set against my Identity field in my clarion dictionary.

Becasue I need to prime my child records, I managed to use Geoff Bomford's GWBInsert template, that I use in many other applications. I had to make a few small tweeks to the netwebform to make it work, adding the following code to the PreInsert2 embed:

! Set UpdateJobs:Primed to 1 so that we prevent duplicate checking.
p_web.SetSessionValue('UpdateJobs:Primed',1)
p_web.setsessionvalue('showtab_UpdateJobs',0)

This has been working great until I upgraded my template to 4.31 at the start of this month. Now when I save my charges, my original record is saved as nulls (together with the related child records) and I get a new record inserted in the parent table with all of my keyed values assigned to it.

The wierd thing is, that if I put my template back to 4.30, and recompile (and update my web subfolder) it still doesn't work anymore ???

I've got 2 production sites where this works absolutely fine, but I now can't recreate it.

Does anyone have any suggestions as to where I might be going wrong. I've been going round in circles now for days.

Regards,

Neil Porter.
Clarion 11.0.13244
NetTalk 11.04

Alan Telford

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: Priming MSSQL Identity field
« Reply #1 on: February 03, 2009, 12:33:26 PM »
Neil. No ideas on your problem, but EmaulateAutoNum is working for me.


e.g. I have a table "DimIndicator" with database driver of "MSSQL".
On the table options it has "EmulateAutoNumKey"=1.
(I'm using 1 instead of true here).

The table has an identity field (not a guid, but a plain long) of "Id_Indicator".
The field options are:
"IsIdentity"=true
"Autonumber"=1,1


The key is called "pk_DimIndicator"
Attributes are: RequireUniqueValue, PrimaryKey, CaseSensitive.
And columns is just "Id_Indicator".


I can confirm this combination is working fine for me in both my win32 app, and my nettalk webserver.

Alan

[attachment deleted by admin]