BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stored Procedure Problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Cenk
Guest





PostPosted: Sat Jul 29, 2006 7:36 pm    Post subject: Stored Procedure Problem Reply with 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
Mark Richards
Guest





PostPosted: Sun Jul 30, 2006 2:16 pm    Post subject: Re: Stored Procedure Problem Reply with quote



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





PostPosted: Sun Jul 30, 2006 3:58 pm    Post subject: Re: Stored Procedure Problem Reply with quote



MS SQL server 2000
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.