グリッドビューにボタンフィールドがあり、そのボタンを押すと最初の列から ID 値が取得され、その ID を select ステートメントで使用してテーブルからデータを取得しますが、このエラー「No Value Give For One」が表示されますまたはそれ以上のパラメータ」
protected void grdData_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = grdData.SelectedRow;
string id = row.Cells[1].Text;
try
{
conn.ConnectionString = conn_string;
conn.Open();
mySQLCommand.Connection = conn;
mySQLCommand.CommandText = "Select [Movie_Description],[Movie_Image] from Movie_tbl where Movie_ID = @Movie_ID";
mySQLCommand.Parameters.Add("@Movie_ID", OleDbType.VarChar).Value = id;
myDataReader = mySQLCommand.ExecuteReader();
if (myDataReader.Read())
{
txtDescription.Text = myDataReader["Movie_Description"].ToString();
}
else
{
txtDescription.Text = "No Such Movie";
}
}
catch (Exception ex)
{
throw ex ;
}
}