Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have created a store procedure in that i used case when statement and that case when result i have to show output


SQL
case 
	when JobCardMst.CardTypeRefId =435 then 'Field Job'
	when JobCardMst.CardTypeRefId =436 then 'Workshop Job'
	else 'The Job Type Something else' end 
as 'Job Type'


i want to display field job into label or textbox into output
how can i?

What I have tried:

SQL
alter procedure prc_AllocatedUserInfo    
@AllocatedToUser varchar(Max)
as     
begin
Declare @CardTypeRefId int=0
select job.Id, job.CustClientLocID,
-- JobCardMst.CardTypeRefId 
--as 'Job Type'
--,
case 
	when JobCardMst.CardTypeRefId =435 then 'Field Job'
	when JobCardMst.CardTypeRefId =436 then 'Workshop Job'
	else 'The Job Type Something else' end 
as 'Job Type'
from job inner join JobCardMst on job.id=JobCardMst.JobId  
inner join JobAllocation on JobAllocation.JobCardMstId=JobCardMst.Id   
where JobAllocation.AllocatedToUser = 'davell' @AllocatedToUser 
end



VB
Public Sub load1()

    Dim SqlCommand As New SqlClient.SqlCommand
    Dim connection As String = ConfigurationManager.ConnectionStrings("strPROD").ConnectionString
    Dim con As New SqlConnection(connection)
    SqlCommand.CommandText = "prc_AllocatedUserInfo"

    SqlCommand.CommandTimeout = 0
    SqlCommand.Connection = con
    SqlCommand.CommandType = CommandType.StoredProcedure
    Dim sqlDA As New SqlDataAdapter(SqlCommand)
    SqlCommand.Parameters.Add("@AllocatedToUser", SqlDbType.VarChar).Direction = ParameterDirection.Input
    SqlCommand.Parameters("@AllocatedToUser").Value = username

    Dim ds As New DataSet()
    sqlDA.Fill(ds)

    'txt1.Text = ListView2.SelectedItems.Item(0).Text
    joblistview1.DataSource = ds.Tables(0)
    joblistview1.DataBind()

    con.Close()
End Sub
Posted
Updated 8-Aug-18 2:46am
v2

1 solution

Try following:
'txt1.Text = ListView2.SelectedItems(0).SubItems(2).Text
 
Share this answer
 
v2
Comments
[no name] 8-Aug-18 6:46am    
nope

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900