Hi
The foll. code generates an error saying : "DataMgr.c" line 4166 Err
Getting Rec .
Any one pl. tell me how do I specify the record number of the first record
in the database and thus transfer all the records in one database to
another.
I have tried using the DmDetach and DmAttach , But that doesn't work b'cos I
feel its due to the wrong record number specification.
code follows :
error = DmGetNextDatabaseByTypeCreator
( true, &stateInfo, TempDBType, TempAppType, true,
&tempCardNo,
&tempDB_ID );
while( error != dmErrCantFind )
{
tempDB = DmOpenDatabase(tempCardNo, tempDB_ID, dmModeReadOnly);
rec_Num = DmNumRecords(tempDB) - 1;
recH = DmGetRecord(tempDB,rec_Num);
if(recH)
recText = MemHandleLock(recH);
index = DmNumRecords(TestDB);
newH = DmNewRecord(TestDB,&index,StrLen(recText));
if(newH)
newText = MemHandleLock(newH);
if(DmWriteCheck (newText, 0,StrLen(recText)) == 0)
error = DmWrite (newText, 0, recText, StrLen(recText));
else
ErrFatalDisplayIf(error, "Could not write into database.");
MemHandleUnlock(newH);
}
MemHandleUnlock(recH);
DmCloseDatabase(tempDB);
DmDeleteDatabase (tempCardNo,tempDB_ID);
error = DmGetNextDatabaseByTypeCreator(true, &stateInfo, TempDBType,
TempAppType, true, &tempCardNo,
&tempDB_ID);
}
}
TIA
Alagesh
--------------------------------------------------------------
Robosoft Technologies, Mangalore, India