3
我得到:C#MySQL的語法錯誤
您的SQL語法錯誤;檢查對應於你的MySQL服務器 版本正確的語法使用近'譜」 WHERE規範ID = 42' 在行1
雖然運行該代碼的手冊:
public System.Drawing.Image GetImage(int index)
{
using (MySqlCommand command = connection.CreateCommand())
{
//command.CommandText = "SELECT imageObj FROM spectra WHERE specId=42"; <== Works OK!
command.CommandText = "SELECT imageObj FROM @tname WHERE [email protected]";
command.Parameters.AddWithValue("@index", index);
command.Parameters.AddWithValue("@tname", "spectra");
using (MySqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return (System.Drawing.Image)Serial.ByteArrayToObject((byte[])reader[0]);
}
}
}
return null;
}
我覺得問題是光譜附近的報價。我怎樣才能刪除它們?
請記住,你不能投了'byte'到'的byte []'... –
無關。功能正常工作時的語法就可以了。 – Igor