でエラーが発生しました
"The parametrized query '(@blue nvarchar(4000))SELECT blueBallImage FROM CorrespondingBal' expects the parameter '@blue',
which was not supplied."
私はHttpHandlerをやっています。
データベースから画像を取得したい。私のコードは以下の通りです。
public void ProcessRequest (HttpContext context) {
string image = context.Request.QueryString["image"];
SqlConnection con = new SqlConnection(@"Data Source=localhost;Initial Catalog=MyCloudGames;Integrated Security=True");
SqlCommand cmd = new SqlCommand("SELECT blueBallImage FROM CorrespondingBall WHERE objective = blue", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add("blue", image);
con.Open();
byte[] ballImage = (byte[])cmd.ExecuteScalar();
con.Close();
context.Response.ContentType = "image/png";
context.Response.OutputStream.Write(ballImage, 78, ballImage.Length - 78);
}
でエラーが発生しました
byte[] ballImage = (byte[])cmd.ExecuteScalar();