我有一张表格,我会把票交给客户。问题出在按钮" make ticket",它在服务器上调用函数hacerticket:
var
ticket:Isucursales1.Tticket;
venta:Isucursales1.Tventa;
begin
ticket:=Isucursales1.Tticket.Create;
venta:=Isucursales1.Tventa.Create;
with Unit1.datos.cdsticket do
begin
Open;
Insert;
// datos.nuevoticket.ExecSQL;
//FieldByName('idticket').AsInteger:=4;
FieldByName('numero').AsInteger:=1;
FieldByName('importe').AsFloat:=StrToFloat(Form3.StringGrid1.Cells[1,0]);
FieldByName('fechae').AsDateTime:=Now();
FieldByName('horae').AsDateTime:=Now();
FieldByName('idsucursal').AsInteger:=1;
end;
with ticket do
begin
numero:=1;
importe:=StrToFloat(StringGrid1.Cells[1,0]);
fechae:=Unit1.datos.cdsticket.FieldByName('fechae').AsString;
horae:=Unit1.datos.cdsticket.FieldByName('horae').AsString;
idsucursal:=1;
end;
GetIsucursales.hacerticket(ticket);
while not Grillaticket.DataSource.DataSet.Eof do
begin
with venta do
begin
idproducto:=Grillaticket.DataSource.DataSet['idproducto'];
cantidad:=Grillaticket.DataSource.DataSet['cantidad'];
GetIsucursales.ventas(venta);
end;
end;
end;
在服务器中: 程序Tsucursales.hacerticket(票:Tticket);
begin
consultas:=Tsucursallaferretera.Create(nil);
with consultas.queryticket do
begin
SQL.Add('insert into ticket(numero,importe,fechae,horae,idsucursal)');
SQL.Add('values (:numero,:importe,:fechae,:horae,:idsucursal);');
ParamByName('numero').AsInteger:=ticket.numero;
ParamByName('importe').AsFloat:=ticket.importe;
ParamByName('fechae').AsString:=ticket.fechae;
ParamByName('horae').AsString:=ticket.horae;
ParamByName('idsucursal').AsInteger:=ticket.idsucursal;
ExecSQL();
end;
end;
问题是"数据截断列数" numero是一个整数,我打算用1(不是一个独特的foeld,我的意思是它可以是任何值)。
我也试过F4并且值正确传入。
请帮助我!
我已经尝试从服务器中移除字段数(上面的第二个代码)并获得: 列被截断的数据" importe&#34 ;;可能是id idticket或插入问题。