Oscarac, te decia que el error me lo da construyendo el procedimiento almacenado en el Enterprise Manager de SQL, cuando le doy comprobar la sintaxis, me sale el error. en la respuesta que le ofrecí a orioncomputer le decía que el parámetro puede tomar diferentes valores ya que es construido de acuerdo a la cantidad de OT que seleccione el usuario, puede ser así:
1.- (dbo.OT.OT = 252011)
2.- (dbo.OT.OT = 252011) OR (dbo.OT.OT = 255011) OR (dbo.OT.OT = 266057) ....
no se si me entiendes.
Primero creo el parámetro:
Código Delphi
[-] for I:=0 to (clbOT.Items.Count -1) do begin bSi:=True; if clbOT.Checked[i]=True then begin sOT:=MidStr(clbOT.Items[i],1,(Pos(' ',clbOT.Items[i])-1)); if bPrimera=True then begin sHav:='(((OT.OT)=' + sOT; bPrimera:=False; bSegunda:=True; end else if bSegunda=True then sHav:=sHav + ' OR (OT.OT)=' + sOT; end; end; if bSi=True then sHav:=sHav + '))'; end;
Para llamarlo sería así:
Crear un ADOCommand.
Código Delphi
[-]ADOCommand.CommandType:=cmdStoredProc; ADOCommand.Connection:=La conexión del sistema; ADOCommand.CommandText:=Nombre del Procedimiento; ADOCommand.Parameters.Refresh; ADOCommand.Parameters.ParamByName('@SHaving').Value:=sHav;
Entiendes lo que quiero hacer.
Gracias.