Answered by:
Display Checkbox value in Crystal Report

Question
-
User-2097065902 posted
Hey all,
I have one gridview, in that i have multiple Checkboxes.
My problem is that i want to display that records in Crystal Report which has been checked in checkbox.
If user selecte multiple Id and press button then all the checked value has been display in Crystal Report or regarding that Id, the value has been display.
For that I have Use Procedure, It will Work, But It display only One record at a time, When Select Multiple Id It will display blank report.
how can i do that?? I am Using VB 2008.
Plz help Me..
Thanx..
Thursday, April 4, 2013 1:55 AM
Answers
-
User-578610739 posted
Hi Itsme89,
For your solution, you can set parameter as string with max width. Now while passing value of checkbox/s, sent value in a string with comma seperated value like '1,2,3,4...' .
In a sp , you can fetch data as value with comma separated value. Then you can modify your sp either 2 approach.
1.
declare @str varchar(max), @par1 varchar(15) set @par1 = '2,4,6,8,7,9,10' select * from CustomerMaster where CustomerID in (2,4,6,8,7,9,10) set @str = 'select * from CustomerMaster where CustomerID in ('+@par1+')'; exec sp_sqlexec @str
or 2 Change sp as below and make one function.
create Function SplitString (@List Varchar(Max), @Delimiter Char(1)) Returns @Items Table (Item Varchar(100)) As Begin Declare @Item Varchar(12), @Pos TinyInt While Len(@List) > 0 Begin Set @Pos = CharIndex(@Delimiter, @List) If @Pos = 0 Set @Pos = Len(@List) + 1 Set @Item = Left(@List, @Pos - 1) Insert @Items Select Ltrim(Rtrim(@Item)) Set @List = SubString(@List, @Pos + Len(@Delimiter), Len(@List)) End Return End Go GO Declare @myTable Table(Id Int, Descs Varchar(max)) Insert Into @myTable Select 1, '08190,737079,1004618,1075562,1272753,1390841,1544201,2591141' Union All Select 2, '335395,359380,741049,1113212,2283999,2908851,2001205615' Union All Select 3, '1212358,2451853,2795175,2001196872 'Select tbl1.Id, tbl1.Descs, fn.Item From @myTable As tbl1 Cross Apply dbo.SplitString(tbl1.Descs, ',') As fn
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, April 12, 2013 2:58 AM
All replies
-
User-1137493631 posted
could you please share your SQL query ?
Thursday, April 11, 2013 7:33 PM -
User-578610739 posted
Hi Itsme89,
For your solution, you can set parameter as string with max width. Now while passing value of checkbox/s, sent value in a string with comma seperated value like '1,2,3,4...' .
In a sp , you can fetch data as value with comma separated value. Then you can modify your sp either 2 approach.
1.
declare @str varchar(max), @par1 varchar(15) set @par1 = '2,4,6,8,7,9,10' select * from CustomerMaster where CustomerID in (2,4,6,8,7,9,10) set @str = 'select * from CustomerMaster where CustomerID in ('+@par1+')'; exec sp_sqlexec @str
or 2 Change sp as below and make one function.
create Function SplitString (@List Varchar(Max), @Delimiter Char(1)) Returns @Items Table (Item Varchar(100)) As Begin Declare @Item Varchar(12), @Pos TinyInt While Len(@List) > 0 Begin Set @Pos = CharIndex(@Delimiter, @List) If @Pos = 0 Set @Pos = Len(@List) + 1 Set @Item = Left(@List, @Pos - 1) Insert @Items Select Ltrim(Rtrim(@Item)) Set @List = SubString(@List, @Pos + Len(@Delimiter), Len(@List)) End Return End Go GO Declare @myTable Table(Id Int, Descs Varchar(max)) Insert Into @myTable Select 1, '08190,737079,1004618,1075562,1272753,1390841,1544201,2591141' Union All Select 2, '335395,359380,741049,1113212,2283999,2908851,2001205615' Union All Select 3, '1212358,2451853,2795175,2001196872 'Select tbl1.Id, tbl1.Descs, fn.Item From @myTable As tbl1 Cross Apply dbo.SplitString(tbl1.Descs, ',') As fn
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, April 12, 2013 2:58 AM