Hello!
here a new problem:
Err GrabaNuevoItem(void) //Record a new item in the actual record
{
UInt16 NuevoIndice;
MemHandle registroH;
Err error=0;
OrderReg item; //It's similar to 'Sales' example struct
NuevoIndice=gNumOrden-1;
registroH = DmGetRecord(PedidosDB, NuevoIndice);
if(!registroH)
error = DmGetLastErr();
else
{
Int16 len = 0;
UInt16 Indice = gNumOrden-1;
len = (MemHandleSize(registroH));
IngresaItem(item.items);
item.cantitems=gcantitems;
{
Char *s;
Int16 length=len; //lose 'len' why?
length += StrLen(item.items[gcantitems-1].codigo)+1;
length += sizeof(item.items[gcantitems-1].cantidad);
length += sizeof(item.items[gcanti
DmResizeRecord(PedidosDB, gNumOrden-1, length);
registroH = DmGetRecord(PedidosDB, gNumOrden-1);
if(!registroH)
FrmCustomAlert(Mensaje,"Handle null", NULL,NULL);
s=MemHandleLock(registroH);
DmWite(s,offsetof(OrderReg,cantitems),&item.cantitems,sizeof(item.cantitems));
DmWrite(s,offsetof(OrderReg,items[gcantitems-1].cantidad),&item.items->cantidad,sizeof(item.items->cantidad));
DmWrite(s,offsetof(OrderReg,items[gcantitems-1].precio),&item.items->precio,sizeof(item.items->precio));
DmStrCopy(s,offsetof(OrderReg,items[gcantitems-1].codigo),item.items[gcantitems-1].codigo);
}
DmReleaseRecord(PedidosDB, Indice, true);
}
return error;
}
Allways say Handle null, the index it's all right.
if delete the second DmGetRecord the handle point to nobody location
Please helpme!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/