我用这个语句来组合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