Page 1 of 1

TUniStoredProc Error

Posted: Fri 05 Feb 2010 04:48
by cxg417
UniStoredProc1.Close;
UniStoredProc1.ParamByName('Param1').AsString:=Value1;
UniStoredProc1.ParamByName('Param2').AsString:=Value2;
UniStoredProc1.ParamByName('Param3').AsSmallInt:=Value3;
//UniStoredProc1.Prepare; <----------------
UniStoredProc1.Open;

Viwe SQL Profiler
exec sP_StoredProc1 NULL, NULL, NULL


UniStoredProc1.Close;
UniStoredProc1.ParamByName('Param1').AsString:=Value1;
UniStoredProc1.ParamByName('Param2').AsString:=Value2;
UniStoredProc1.ParamByName('Param3').AsSmallInt:=Value3;
UniStoredProc1.Prepare;
UniStoredProc1.Open;
UniStoredProc1.OpenNext;

Viwe SQL Profiler
exec sP_StoredProc1 Value1, Value2, Value3

but
Raise 'Cannot OpenNext if Statement is Prepared'
________
Hemp Marijuana

Posted: Fri 05 Feb 2010 10:24
by Dimon
To solve the problem execute the UniStoredProc1.PrepareSQL method before setting parameter values.