Buenas , Ayuda,
Necesito Mandar unos o varios parametros para que se ejecute un SP, este es el codigo del Sp Utilizando SQL 2005:
Código SQL
[-]
CREATE PROCEDURE dbo.Cuentas_Proveedor(@SvendorId varchar(100), @SCuenta varchar(50), @SCuenta0 varchar(50))
AS
BEGIN
SELECT
VendorId,
Vendor,
Documento,
fecha,
descriccion,
cuenta,
debito,
credito
FROM
GL20000
INNER JOIN GL00100 ON (GL20000.ACTINDX = dbo.GL00100.ACTINDX)
INNER JOIN GL40200 ON (dbo.GL00100.ACTNUMBR_3 = dbo.GL40200.SGMNTID)
WHERE
vendorid = @SvendorId AND
cuenta IN (@SCuenta,@SCuenta0)
GROUP BY
VendorId,
Vendor,
Documento,
fecha,
descriccion,
cuenta,
debito,
credito
GL00100.ACTINDX
ORDER BY
6,4
END
El Sp Trabaja Muy Bien pero podria ser ejecutado con Uno o Varios Parametros en
cuenta IN (@SCuenta,@SCuenta0).
La Codificacion del Delphi es la Siguiente:
Código Delphi
[-]
DMTables.Reporte_Ctas_Proveedores(DMTables.DT_PM00200VENDORID.AsString,ListBox2.Items[0],ListBox2.Items[1]);
procedure TDMTables.Reporte_Ctas_Proveedores(SVendorId, sCuenta0, sCuenta1: string);
begin
ADOSP_Reporte_Ctas_Provee.Parameters[1].Value := SVendorId;
ADOSP_Reporte_Ctas_Provee.Parameters[2].Value := sCuenta0;
ADOSP_Reporte_Ctas_Provee.Parameters[3].Value := sCuenta1;
ADOSP_Reporte_Ctas_Provee.Requery();
frxReport_Cta_Provee.PrepareReport();
frxReport_Cta_Provee.ShowReport();
FrmListCuentas_Provee.ListBox1.Clear;
FrmListCuentas_Provee.ListBox2.Clear;
FrmListCuentas_Provee.Close;
end;
Lo que deseo hacer es que cuando se envia 1 parametro solamente me trabaje con un parametro, pero me da el error "List indexout of bounds(1)", no encuentra el parametro 1,
1. Como puedo Mandar un Parametro en Blanco?
2. Si deseo Colocar mas items como se hace?
espero que haigan entendido lo sucedido.
gracias de ante manos....