我用這個語句來組合2列值。我怎樣才能在c#中使用concat sql函數?
select concat(l_name," ",f_name) as "Full Name" from students;
我試圖在dreamcoder這種說法和它工作得很好,但是當我在C#中使用這種說法,它給了我沒有方法重載的錯誤。似乎concat()被認爲是一個方法過載時,我把它放在C#中。有沒有什麼可能的方式,我可以在我的C#中使用這個聲明?
public DataTable ExecuteQuery(string cmdtext)
{
DataTable table = new DataTable();
var refDataAdapter = new MySqlDataAdapter(new MySqlCommand(cmdtext, CN));
refDataAdapter.Fill(table);
return table;
}
dataGridView1.DataSource = ExecuteQuery("select concat(l_name,", ",f_name) as FullName from students");
我用這個代碼來填充顯示錶上我的datagridview
請在下次提到SQL Server Version。 – Sohail