![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
|
Problemas con parametro Null en MSSQL Server 2000
Hola querido club!!!
Tengo el siguiente problema: tengo un stored procedure en sqlserver al que le paso parametros desde delphi a traves de dbExpress con un componente SQLDataSet seteado como StoredProc, es decir, Código:
SQLDataSet.CommandType := ctStoredProc; SQLDataSet.CommandText := 'Nombre del Procedimiento'; que me avisan que hubo un error con los datos procesados, no trabaja como yo quisiera. Para ser mas claro en el asunto, el mismo procedimiento almacenado esta hecho en interbase 6.0 y cuando seteo otro componente SQLDataSet con conexion Interbase y le asigno al parametro valor nulo, este si me devuelve los datos que espero mostrar en una grilla. Este es el codigo completo: Código:
procedure TForm1.ejecturar;
begin
case RadioGroup1.ItemIndex of
0:
begin
with Interbase do
begin
Close;
Prepared := True;
ParamByName('id_empresa').AsString := '01';
ParamByName('fecha1').AsDate := cxDateEdit1.Date;
ParamByName('fecha2').AsDate := cxDateEdit2.Date;
ParamByName('nro_base').AsInteger := 0;
if ParamByName('id_moneda').IsNull then
begin
ParamByName('id_moneda').DataType := ftInteger;
ParamByName('id_moneda').Bound := True;
ParamByName('id_moneda').Clear;
end;
end;
end;
1:
begin
with Mssql do
begin
Close;
CommandText := '';
CommandType := ctStoredProc;
CommandText := 'L_ASIENTOS_D';
Prepared := True;
ParamByName('id_empresa').AsString := '01';
ParamByName('fecha1').AsSQLTimeStamp := DateTimeToSQLTimeStamp(cxDateEdit1.Date);
ParamByName('fecha2').AsSQLTimeStamp := DateTimeToSQLTimeStamp(cxDateEdit2.Date);
ParamByName('nro_base').AsInteger := 0;
if ParamByName('id_moneda').IsNull then
begin
ParamByName('id_moneda').DataType := ftInteger;
ParamByName('id_moneda').Clear;
ParamByName('id_moneda').Bound := True;
end;
end;
end;
end;
ClientDataSet1.Close;
ClientDataSet1.Open;
end;
|
|
#2
|
|||
|
|||
|
El problema persiste en delphi 6 ya sea porque tiene un bug dbExpress o por otro motivo que no se cual sera.
Lo he probado en delphi 7 y anda, lo he probado en Delphi 2005 y anda.... Cosas de la programacion, no??? Gracias igual a los que leyeron este hilo. El driver con que trabajo es de Core Lab para dbExpress. Lo unico que cambie es la parte del seteo con sqlserver Código:
procedure TForm1.ejecturar;
begin
try
Screen.Cursor := crHourGlass;
case RadioGroup1.ItemIndex of
0:
begin
with Interbase do
begin
Close;
Prepared := False;
Prepared := True;
ParamByName('id_empresa').AsString := '01';
ParamByName('fecha1').AsDate := cxDateEdit1.Date;
ParamByName('fecha2').AsDate := cxDateEdit2.Date;
ParamByName('nro_base').AsInteger := 0;
ParamByName('id_moneda').Value := null;
if ParamByName('id_moneda').IsNull then
begin
ParamByName('id_moneda').DataType := ftInteger;
ParamByName('id_moneda').Bound := True;
ParamByName('id_moneda').Clear;
end;
end;
end;
1:
begin
with Mssql do
begin
Close;
Params.Clear;
CommandText := '';
CommandType := ctStoredProc;
CommandText := 'L_ASIENTOS_D';
if Prepared then
Prepared := False;
Prepared := True;
ParamByName('id_empresa').AsString := '01';
ParamByName('fecha1').AsSQLTimeStamp := DateTimeToSQLTimeStamp(cxDateEdit1.Date);
ParamByName('fecha2').AsSQLTimeStamp := DateTimeToSQLTimeStamp(cxDateEdit2.Date);
ParamByName('nro_base').AsInteger := 0;
ParamByName('id_moneda').Value := null;
end;
end;
end;
ClientDataSet.Open;
finally
Screen.Cursor := crDefault;
end;
|
![]() |
|
|
|