 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Cenk Guest
|
Posted: Sat Jul 29, 2006 7:36 pm Post subject: Stored Procedure Problem |
|
|
Hi,
i have a SP and its code is like below;
CREATE PROCEDURE ema
@pricename varchar(100),
@tablename varchar(1000)
AS
declare @SQL varchar(1000)
SELECT @SQL = 'select ['+@pricename+'] from ['+@tablename+']'
exec(@SQL)
The problem is, i have a table named DAY1(USD/CHF1998). When i use this
table name in my ST it gives error. "...class EDBEngineError with message
could not find object". Below is the code how i call the SP in my
application. On the otherhand, when i use a table named MONTH1, it works
fine.
TStoredProc *Stp;
TParam *P1, *P2;
Stp= new TStoredProc (this);
Stp->DatabaseName = "Slave";
Stp->StoredProcName = "ema";
P1 = new TParam(Stp->Params, ptInput);
P2 = new TParam(Stp->Params, ptInput);
try
{
Stp->Params->Items[0]->Name = price;
Stp->Params->Items[1]->Name = table;
Stp->ParamByName(price)->AsString = price;
Stp->ParamByName(table)->AsString = table;
Stp->Open(); -------------> gives error here!
}
__finally
{
delete P1;
delete P2;
}
for (int i = 0;i<rowtemp ;i++)
{
arr.push_back(StrToFloat(Stp->FieldByName(price)->AsString));
Stp->Next ();
} |
|
| Back to top |
|
 |
Mark Richards Guest
|
Posted: Sun Jul 30, 2006 2:16 pm Post subject: Re: Stored Procedure Problem |
|
|
It is normal practice to name tables using only numeric, alphabetic and
underscore characters. I am surprised your database even allowed you to
create a table using DAY1(USD/CHF1998).
Which database are you using by the way?
--
---------------------------------------
And a pointless sig...
---------------------------------------
There are 10 types of people in the world
those that understand binary and those that don't
"Cenk" <cenk1536 (AT) yahoo (DOT) com> wrote in message
news:44cb7281 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
i have a SP and its code is like below;
CREATE PROCEDURE ema
@pricename varchar(100),
@tablename varchar(1000)
AS
declare @SQL varchar(1000)
SELECT @SQL = 'select ['+@pricename+'] from ['+@tablename+']'
exec(@SQL)
The problem is, i have a table named DAY1(USD/CHF1998). When i use this
table name in my ST it gives error. "...class EDBEngineError with message
could not find object". Below is the code how i call the SP in my
application. On the otherhand, when i use a table named MONTH1, it works
fine.
TStoredProc *Stp;
TParam *P1, *P2;
Stp= new TStoredProc (this);
Stp->DatabaseName = "Slave";
Stp->StoredProcName = "ema";
P1 = new TParam(Stp->Params, ptInput);
P2 = new TParam(Stp->Params, ptInput);
try
{
Stp->Params->Items[0]->Name = price;
Stp->Params->Items[1]->Name = table;
Stp->ParamByName(price)->AsString = price;
Stp->ParamByName(table)->AsString = table;
Stp->Open(); -------------> gives error here!
}
__finally
{
delete P1;
delete P2;
}
for (int i = 0;i<rowtemp ;i++)
{
arr.push_back(StrToFloat(Stp->FieldByName(price)->AsString));
Stp->Next ();
}
|
|
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Sun Jul 30, 2006 3:58 pm Post subject: Re: Stored Procedure Problem |
|
|
MS SQL server 2000 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|