0
我有一个C#客户端应用程序,它将一个图像和一个ID一起发送到一个web服务。然后webservice接收这些信息并将它们插入到MySQL数据库中。但有人,webmethod无法识别图像,相反,它只是将保存在数据库中....任何人都可以告诉我我在哪里发生错误?提前致谢!MySQL不识别图像
[WebMethod]
public string sendDataToMySql(string application_id, byte[] buffer)
{
string MyConString = "SERVER=localhost;" +
"DATABASE=test;" +
"UID=root;" +
"PASSWORD=password;";
MySqlConnection connection = new MySqlConnection(MyConString);
connection.Open();
MySqlCommand command = new MySqlCommand("", connection);
command.CommandText = "UPDATE application SET icon='@icon' WHERE application_id='" + application_id +"';";
MySqlParameter oParam1 = command.Parameters.Add("@icon", MySqlDbType.Blob);
oParam1.Value = buffer;
command.ExecuteNonQuery();
connection.Close();
return "Data was inserted successfully!";
}
使用“@图标”而不是“@图标”工作!谢谢!我不知道为什么我之前没有想到... – BurninatorDor 2011-12-20 15:18:08