In my table, I have a field of firstname
and lastname
, now what I want is to set firstname
and lastname
as displaym
CREATE VIEW [dbo].[get_view] AS SELECT CONCAT(sell_tb.Name,extra_tb.Name,purchase_tb.Name) AS Name FROM sell_tb FULL JOIN extra_tb ON extra_tb.E_ID = sell_tb.E_ID FULL JOIN purchase_tb ON purchase_tb.S_ID = sell_tb.S_ID;
private void alldata1()
{
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from [get_view]";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "Name";
conn.Close();
}