Re: An unknown error has occured...




Do you have lookup fields defined? If you do you will get an error like this
when you run out of the IDE with debug set to stop on errors.
There is a Try/Fail block in the Adodb code for lookups that generates this
error. If you set the LookupCache property to true you won't get the error


I have a problem using the ADO components connectiong to a MS SQL 2000
server.

I use a TADO Dataset and need to insert a new post into that dataset. But
when I execute the code I get an unknown exception on the first and second
line. (Project raised exception class EOleException with message "Ett okänt
fel har uppstått." (An unknown error has occured)

If I select break to get into debug mode I am inside the function
TCustomADODataSet.LocateRecord and on the line

if FieldCount = 1 then
FLookupCursor.Find(GetFilterStr(FieldByName(KeyFields), eyFields), KeyValues,
Partial), 0, adSearchForward, EmptyParam)

if I select continue I get another error and then it all goes through no
problem. I have tried rearranging the statements and always get error on the
firs couple of lines regardless the roder they are in.

My code follows below:

dmSVABPADM.ADOdsBest.Insert;

dmSVABPADM.ADOdsBestFRANVARANDE.AsInteger:=0;
dmSVABPADM.ADOdsBestORSAK.AsInteger:=-1;


dmSVABPADM.ADOdsBestARBETSPLATS.AsString:=PString(cbArbetsplats1.Items.Objects[cbArbetsplats1.ItemIndex])^
;


dmSVABPADM.ADOdsBestARBETSTID.AsInteger:=trunc(frac(dtpEXP***.Time)*1440+0.5)-trunc(frac(dtpEXPStart.Time
)*1440+0.5);


dmSVABPADM.ADOdsBestDATUM.AsDateTime:=int(dtpEXPDatum.Date);
dmSVABPADM.ADOdsBestSTATUS.AsInteger:=0;

dmSVABPADM.ADOdsBestSTARTAR.AsInteger:=trunc(frac(dtpEXPStart.Time)*1440+0.5);
);
dmSVABPADM.ADOdsBestSLUTAR.AsInteger:=trunc(frac(dtpEXPSlut.Time)*1440+0.5);

(removed init of some fields here)

dmSVABPADM.ADOdsBest.Post;


The definition of the table is as follows:

CREATE TABLE dbo.VP_BESTALLNING (
BEST_ID Numeric(18, 0) IDENTITY NOT NULL,
STATUS Int,
DATUM DateTime,
ARBETSPLATS Char(20),
STARTAR Int,
SLUTAR Int,
ARBETSTID Int,
FRANVARANDE Numeric(18, 0),
ORSAK Int,
KOMMENTAR VarChar(200),
ARBETSPASS Numeric(18, 0),
BESTALLARE Numeric(18, 0),
HANDLAGGARE Numeric(18, 0),
KOMP1 Int,
KOMP2 Int,
KOMP3 Int,
KOMP4 Int,
KOMP5 Int,
BEFTYP Int,
BEF Int,
BESTTID DateTime,
CONSTRAINT PK_VP_BESTALLNING PRIMARY KEY CLUSTERED (
BEST_ID
)
) ON "PRIMARY"
GO

--
--
Et in Arcadia Ego - I Tego Arcana Dei

--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.