Cannot get record

I have a MSSQL file called borger_handleplan.
It has a primary key called BOR:Borger_Handleplan_id
My code is:

db.debugout('toolbar9')
Access:Borger_Handleplan.USEFILE()
bor_id = SUB(command(2),2,LEN(CLIP(command(2)))-1)
db.debugout(bor_id,'bor_id')
!db.debugout(command())
!db.debugout(command(2),'Command(2)')
!db.debugout(LEN(CLIP(command(2))),'len')
Access:Borger_Handleplan.fetch(BOR:Borger_Handleplan_id)

Which translates to from trace:
07604H(1) 10:24:19.530 Preparing Statement 0120B6A0H : SELECT BOR_ID,BOR_Filnavn,BOR_BoerneData_id,BOR_Udloebsdato,BOR_ErstatterID,BOR_Oprettet_af,BOR_Oprette_dato,BOR_Godkendt_Af,BOR_Godkendt_dato,BOR_beskrivelse,BOR_skabelon_id,BOR_laast,BOR_Status,BOR_institutions_id,BOR_SagID,SLETTET,BOR_DokDato,FROM_MAIL,TO_MAIL,SUBJECT,MAIL_SEND_DATE,MAIL_SEND_TIME,MAGTANVENDELSES_ID,DOKTYPE,BOR_BLOB FROM dbo.borger_handleplan WHERE BOR_ID = ? Time Taken:0.00 secs
the interesting item is :“WHERE BOR_ID = ?”

I am on
mscorlib,4.0.0.0,C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
Clarion,11.1.0.13810,C:\Clarion11\bin\Clarion.exe

I have tried with both FETCH syntax and ABC syntax with same result.

Am I using a wrong version of the mssql driver or?

Best regards

Edvard Korsbæk

probably it should be
BOR:bor_id = SUB(command(2),2,LEN(CLIP(command(2)))-1)

A couple of things:

Firstly the where bor_id = ? is exactly what you expect to see in the trace file. The ? is a placeholder for a bound value that has been passed to the server. In this case it is likely to be the value of bor:bor_id.

Secondly, as pointed out in the other post, you need to prime the value of your primary key field before the call, and that is the column bor:bor_id and not the local variable bor_id.

Thanks- I Turns out it wasn’t an error 40 (middle overweight) — it’s actually an error 55, which is a bit further along the scale.