TUniStoredProc Error

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cxg417
Posts: 41
Joined: Thu 26 Mar 2009 08:07

TUniStoredProc Error

Post by cxg417 » Fri 05 Feb 2010 04:48

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
Last edited by cxg417 on Tue 15 Feb 2011 15:00, edited 1 time in total.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 05 Feb 2010 10:24

To solve the problem execute the UniStoredProc1.PrepareSQL method before setting parameter values.

Post Reply