vimalfor5 0 Newbie Poster

Hi all,

i want to create one crystalreport from following storeprocedure

CREATE PROCEDURE dbo.usp_proc1
(
 @ID as int
)

as 

declare @Var1 as varchar(1000);
set @Var1 = ' select ID,Name,Email from Demo where ID='+Convert(varchar,@ID)

print @Var1;
exec(@Var1);

This is not the actual code but its a demo of original, i'm using this type of code because i want to join two or more databases with supplied database name like

@dbName+"Connection"

where @dbName is the supplied argument


the problem is when i choose this procedure as the database field for the crystal report the select fields (table columns of the query ) are not displaying

i also tried

CREATE PROCEDURE dbo.usp_proc1
(
 @ID as int
)

as 

declare @Var1 as varchar(1000);
set @Var1 = ' select ID,Name,Email from Demo where ID='+Convert(varchar,@ID)

print @Var1;
exec(@Var1);

/* select '' as ID,'' as Name,'' as Email */

still it is not working

i dnt want to create a separate dataset or i dnt want to change the logic of the entire.. !!!
any other suggestions are always welcome
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.