See i am retrieving first name and last name as full name
SELECT (FirstName + ' '+ LastName ) as FullName From Employees
C#:
private void PopulateEmployees()
{
string conString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
string sqlStatment = "SELECT (FirstName + ' '+ LastName ) as FullName From Employees";
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlCommand cmd = new SqlCommand(sqlStatment, con))
{
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
con.Open();
DataSet ds = new DataSet();
da.Fill(ds);
this.gvLinks.DataSource = ds;
this.gvLinks.DataBind();
con.Close();
}
}
}
}
HTML:
<asp:GridView ID="gvLinks" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="FullName" HeaderText="FullName" />
</Columns>
</asp:GridView>