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