Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with decimal values when saving a CA
Message
De
03/12/2003 20:41:50
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
 
 
À
03/12/2003 15:42:31
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00855604
Message ID:
00855690
Vues:
16
I found the problem, Just forgot to define the size and decimal value for numeric fileds in the SP at the server side.


>Im a table in SQL Server with I have some numeric fields with 4 decimal places.
>When I save the CA with a numeric value with 4 decimal places, it saves only 1 decimal place at the server side.
>Does someone have an ideia why ?
>Any ideia is welcome.
>Thanks in advance.
>Peter
>
>The CA
>
>DEFINE CLASS ca_formas_pgto_lote3 AS ca_base
>
>
>	CursorSchema = "CODIGO_FORMAS_PGTO_LOTE I, COD_LOTEAMENTO I, COD_LOTE I,  TIPO_PGTO C(8),  PRESTACOES I,  CONSTANTE_LOTE N(14,4), CONSTANTE_LOTE_AV N(14,4),  CONSTANTE_ENTRADA N(14,4), TIPO_CAD C(1)"
>	Name = "ca_formas_pgto_lote3"
>
>
>	PROCEDURE Init
>		LOCAL llReturn
>		DO CASE
>		CASE NOT PEMSTATUS(THIS, '__VFPSetup', 5)
>			THIS.ADDPROPERTY('__VFPSetup', 0)
>		CASE THIS.__VFPSetup = 2
>			THIS.__VFPSetup = 0
>			RETURN
>		ENDCASE
>		llReturn = DODEFAULT()
>		IF THIS.lAutoGenerate
>			THIS.CA_AutoUpdate()
>		ENDIF
>		*** Select connection code: DO NOT REMOVE
>		SET MULTILOCKS ON
>		THIS.DATASOURCE = oCA.DATASOURCE
>		***<SelectCmd>
>		TEXT TO This.SelectCmd NOSHOW
>		SELECT Codigo_Formas_Pgto_Lote, Cod_loteamento, Cod_lote, Tipo_pgto, Prestacoes, Constante_lote, Constante_lote_AV, Constante_entrada, Tipo_cad FROM dbo.Formas_Pgto_Lote WHERE Cod_loteamento = ?pCod_Loteamento
>		ENDTEXT
>		***</SelectCmd>
>
>		***<DeleteCmd>
>		TEXT TO This.DeleteCmd NOSHOW
>		EXECUTE SPA_DEL_FORMAS_PGTO_LOTE  ?ca_Formas_pgto_lote4.Codigo_Formas_Pgto_Lote
>		ENDTEXT
>		***</DeleteCmd>
>
>		***<InsertCmd>
>		TEXT TO This.InsertCmd NOSHOW
>		EXECUTE SPA_INS_FORMAS_PGTO_LOTE  ?ca_Formas_pgto_lote4.COD_LOTEAMENTO,  ?ca_Formas_pgto_lote4.COD_LOTE,  ?ca_Formas_pgto_lote4.TIPO_PGTO,  ?ca_Formas_pgto_lote4.PRESTACOES,  ?ca_Formas_pgto_lote4.CONSTANTE_LOTE, ?ca_Formas_pgto_lote4.CONSTANTE_LOTE_AV, ?ca_Formas_pgto_lote4.CONSTANTE_ENTRADA, ?ca_Formas_pgto_lote4.TIPO_CAD
>		ENDTEXT
>		***</InsertCmd>
>
>		***<UpdateCmd>
>		TEXT TO This.UpdateCmd NOSHOW
>		EXECUTE SPA_UPD_FORMAS_PGTO_LOTE  ?ca_Formas_pgto_lote4.CODIGO_FORMAS_PGTO_LOTE,  ?ca_Formas_pgto_lote4.COD_LOTEAMENTO,  ?ca_Formas_pgto_lote4.COD_LOTE,  ?ca_Formas_pgto_lote4.TIPO_PGTO,  ?ca_Formas_pgto_lote4.PRESTACOES,  ?ca_Formas_pgto_lote4.CONSTANTE_LOTE, ?ca_Formas_pgto_lote4.CONSTANTE_LOTE_AV, ?ca_Formas_pgto_lote4.CONSTANTE_ENTRADA, ?ca_Formas_pgto_lote4.TIPO_CAD
>		ENDTEXT
>		***</UpdateCmd>
>
>
>		*** End of Setup code: DO NOT REMOVE
>		IF THIS.__VFPSetup = 1
>			THIS.__VFPSetup = 2
>		ENDIF
>		RETURN llReturn
>	ENDPROC
>
>
>	PROCEDURE AutoOpen
>		*** Setup code: DO NOT REMOVE
>		IF NOT PEMSTATUS(THIS, '__VFPSetup', 5)
>			THIS.ADDPROPERTY('__VFPSetup', 1)
>			THIS.INIT()
>		ENDIF
>		*** End of Setup code: DO NOT REMOVE
>		IF NOT DODEFAULT()
>			RETURN .F.
>		ENDIF
>		NODEFAULT
>	ENDPROC
>
>
>ENDDEFINE
>
>
>
>The table tructure in SQL
>
>CREATE TABLE [Formas_Pgto_Lote] (
>	[Codigo_Formas_Pgto_Lote] [int] IDENTITY (1, 1) NOT NULL ,
>	[Cod_loteamento] [int] NOT NULL ,
>	[Cod_lote] [int] NOT NULL ,
>	[Tipo_pgto] [char] (8) COLLATE Latin1_General_CI_AS NULL ,
>	[Prestacoes] [smallint] NULL ,
>	[Constante_lote] [numeric](12, 4) NULL ,
>	[Constante_lote_AV] [numeric](12, 4) NULL ,
>	[Constante_entrada] [numeric](12, 4) NULL ,
>	[Tipo_cad] [char] (1) COLLATE Latin1_General_CI_AS NULL ,
>	CONSTRAINT [Codigo_Formas_Pgto_Lote] PRIMARY KEY  CLUSTERED
>	(
>		[Codigo_Formas_Pgto_Lote]
>	)  ON [PRIMARY]
>) ON [PRIMARY]
>GO
>
>
>The SP for insert in SQL
>
>
>CREATE PROCEDURE  SPA_INS_Formas_Pgto_Lote
>@COD_LOTEAMENTO INT
>,@COD_LOTE INT
>,@TIPO_PGTO CHAR(8)
>,@PRESTACOES SMALLINT
>,@CONSTANTE_LOTE NUMERIC
>,@CONSTANTE_LOTE_AV NUMERIC
>,@CONSTANTE_ENTRADA NUMERIC
>,@TIPO_CAD CHAR(1)
>
>AS
>BEGIN TRANSACTION
>
>INSERT INTO Formas_Pgto_Lote(
>COD_LOTEAMENTO
>,COD_LOTE
>,TIPO_PGTO
>,PRESTACOES
>,CONSTANTE_LOTE
>,CONSTANTE_LOTE_AV
>,CONSTANTE_ENTRADA
>,TIPO_CAD
>)
> VALUES (@COD_LOTEAMENTO
>,@COD_LOTE
>,@TIPO_PGTO
>,@PRESTACOES
>,@CONSTANTE_LOTE
>,@CONSTANTE_LOTE_AV
>,@CONSTANTE_ENTRADA
>,@TIPO_CAD
>)
>IF (@@ERROR <> 0)
>	BEGIN
>		ROLLBACK TRANSACTION
>		RAISERROR 65006 'Erro na inclusão do registro'
>	END
>ELSE
>	BEGIN
>		COMMIT TRANSACTION
>	END
>GO
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform