Avatar of dpicco
dpicco
Flag for United States of America asked on

line continuation in asp.net markup

Hello experts,
I have a very long sql in my asp.net markup like this. What line continuation character do I use? The compiler says "if this attribute value is enclosed in quotation marks, the quotation marks must match."

            <asp:SqlDataSource ID="sdsBonuses" runat="server" 
                ConnectionString="<%$ ConnectionStrings:AdHocReportingConnectionString %>" 
                SelectCommand = "select approved_denied_by=case when b.bonus_status = 'Denied' then denied_by when b.bonus_status = 'Approved' then approved_by else null end,
                                            approved_denied_date=case when b.bonus_status = 'Denied' then denied_date when b.bonus_status = 'Approved' then approved_date else null end, b.*,rtrim(p.first_name)+' '+rtrim(p.last_name) Name,rtrim(ps.first_name)+' '+rtrim(ps.last_name) submitter_name 
                                    from bonus_local b, people p , people ps
                                    where ps.network_account = b.created_by and p.employee_id = b.employee_id and b.is_deleted=0 and b.bonus_status in ('Pending Approval','Denied','Approved')
                                    /* and employee_status<>'terminated'  */  
                                    and case b.bonus_status when 'Denied' then datediff(dd,denied_date,getdate()) 
															when 'Approved' then datediff(dd,approved_date,getdate())
															else 0 end < 1
                                    and p.charge_to_location in 
                                    (
	                                    select distinct location_num
	                                    from role_location a, gldm_location b
	                                    where scheme_cd ='PRO' and role_cd <>'spprt'
	                                    and employee_id = (select employee_id from people where network_account = '" + Session["uid"].ToString() + @"')
	                                    and 
	                                    (
	                                    a.location_cd_prefixed = 'div0'+rtrim(b.division_num)
	                                    or
	                                    a.location_cd_prefixed = 'com0'+rtrim(b.company_num)
	                                    or
	                                    a.location_cd_prefixed = 'OPE0'+rtrim(b.operation_num)
	                                    or
	                                    a.location_cd_prefixed = 'BUS0'+rtrim(b.business_unit_num)
	                                    or
	                                    a.location_cd_prefixed = 'TER0'+rtrim(b.territory_num)
	                                    or
	                                    a.location_cd_prefixed = 'MAR0'+rtrim(b.market_num)
	                                    or
	                                    a.location_cd_prefixed = 'ARE0'+rtrim(b.market_num)
	                                    or
	                                    a.location_cd_prefixed = 'Meg0'+rtrim(b.mega_location_num) 
	                                    or
	                                    a.location_cd_prefixed = location_num
                                        )
                                    )
                                    order by rtrim(p.first_name)+' '+rtrim(p.last_name) "
               >
            </asp:SqlDataSource>

Open in new window

ASP.NET

Avatar of undefined
Last Comment
dpicco

8/22/2022 - Mon
abhinayp86

try this

SelectCommand = '<%# "select approved_denied_by=case when b.bonus_status = 'Denied' then denied_by when b.bonus_status = 'Approved' then approved_by else null end, _
                                            approved_denied_date=case when b.bonus_status = 'Denied' then denied_date when b.bonus_status = 'Approved' then approved_date else null end, b.*,rtrim(p.first_name)+' '+rtrim(p.last_name) Name,rtrim(ps.first_name)+' '+rtrim(ps.last_name) submitter_name 
                                    from bonus_local b, people p , people ps
                                    where ps.network_account = b.created_by and p.employee_id = b.employee_id and b.is_deleted=0 and b.bonus_status in ('Pending Approval','Denied','Approved')
                                    and employee_status<>'terminated'  */  
                                    and case b.bonus_status when 'Denied' then datediff(dd,denied_date,getdate()) 
															when 'Approved' then datediff(dd,approved_date,getdate())
															else 0 end < 1
                                    and p.charge_to_location in 
                                    (
	                                    select distinct location_num
	                                    from role_location a, gldm_location b
	                                    where scheme_cd ='PRO' and role_cd <>'spprt'
	                                    and employee_id = (select employee_id from people where network_account = '" + Session["uid"].ToString() + @"')
	                                    and 
	                                    (
	                                    a.location_cd_prefixed = 'div0'+rtrim(b.division_num)
	                                    or
	                                    a.location_cd_prefixed = 'com0'+rtrim(b.company_num)
	                                    or
	                                    a.location_cd_prefixed = 'OPE0'+rtrim(b.operation_num)
	                                    or
	                                    a.location_cd_prefixed = 'BUS0'+rtrim(b.business_unit_num)
	                                    or
	                                    a.location_cd_prefixed = 'TER0'+rtrim(b.territory_num)
	                                    or
	                                    a.location_cd_prefixed = 'MAR0'+rtrim(b.market_num)
	                                    or
	                                    a.location_cd_prefixed = 'ARE0'+rtrim(b.market_num)
	                                    or
	                                    a.location_cd_prefixed = 'Meg0'+rtrim(b.mega_location_num) 
	                                    or
	                                    a.location_cd_prefixed = location_num
                                        )
                                    )
                                    order by rtrim(p.first_name)+' '+rtrim(p.last_name)"%>' 

Open in new window


its either <%# (asp.net 3.5) or <%$(not sure about 4.0)
Paul Jackson

The continuation character is an underscore ensure there is a space between the last character on the line and the underscore.
I think that you will possibly need to close each line with a " and use an & as well like this :


"some string " & _
"another string " & _
...
SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Vikram Singh Saini

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
dpicco

ASKER
thank you. That worked.
Your help has saved me hundreds of hours of internet surfing.
fblack61