Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
drop down list concatenation three data text field using sql server 2005 stored procedure.how to solve it.
Posted
Comments
ZurdoDev 13-Mar-13 11:43am    
Concatenate them together. Where's the issue?
Ashvinrajkot 13-Mar-13 11:56am    
in drop down list i can display like this BranchName-Vehicletype-Date.e.g. Eagle-Truck-1/1/2013
ZurdoDev 13-Mar-13 11:57am    
See solution 2.
Ashvinrajkot 13-Mar-13 12:01pm    
public static void FillDropDownListParcelLoadingID(DropDownList ddl)
{
//Step 1:Create Connection Object

SqlConnection objConn = new SqlConnection();
objConn.ConnectionString = ConfigurationManager.ConnectionStrings["Eagle TradelinkConnectionString"].ToString();
objConn.Open();
//step 2:Create Command Object

SqlCommand objCmd = new SqlCommand();
objCmd.Connection = objConn;

objCmd.CommandType = CommandType.StoredProcedure;
objCmd.CommandText = "PR_ParcelLoading&Unloading_SelectDropDownList";

SqlDataReader objSdr = objCmd.ExecuteReader();
ddl.DataSource = objSdr;
ddl.DataTextField =
ddl.DataValueField = "ParcelLoadingID";
ddl.DataBind();
ddl.Items.Insert(0, new ListItem("Select one", "-99"));

//step 3:Close Connection

objConn.Close();
}

in data text field what is given?????
ZurdoDev 13-Mar-13 12:03pm    
No, in your SQL, concatenate them together.

1 solution

SELECT FirstColumn + ISNULL(' ' + SecondColumn , '') + ISNULL(' ' + ThirdColumn , '') from YourTable
 
Share this answer
 

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