SELECT Trainer.id AS idTrainer, surname, lastname, name,
if(month = '', 'NO',month) as monthT, quarter, halfyear, year, id_Person, photo
FROM Trainer, Person
WHERE Trainer.id_Person = Person.id
在phpMyAdmin回報良好或「否」或月如何將byte []轉換爲varchar?
在C#if(month = '', 'NO',month) as monthT
返回byte[]
,但我需要回到NO
如果一個月爲空,否則返回month
。
我的C#代碼如下所示:
string sql = @" SELECT Trainer.id AS idTrainer, surname, lastname, name, if(month = '', 'NO',month) as monthT, quarter, halfyear, year, id_Person, photo
FROM Trainer, Person
WHERE Trainer.id_Person = Person.id";
using (MySqlConnection connection = ConnectToDataBase.GetConnection())
{
MySqlCommand command = new MySqlCommand(sql, connection);
MySqlDataAdapter adapter = new MySqlDataAdapter();
connection.Open();
adapter.SelectCommand = command;
}
,問題是......? – CesarGon 2010-10-10 14:21:02
你的問題很難理解。你可以發佈CREATE TABLE語句嗎? C#是否返回字節[]而不是字符串,還是你希望它返回byte []而不是字符串?你爲什麼使用空而不是_NULL_? – 2010-10-10 14:21:57
如何將字節[]轉換爲字符串...意味着sql – Mediator 2010-10-10 14:22:14