SqlDataReaderを使用してデータベースからデータを取得しようとしています
しかし、 「System.Data.SqlClient.SqlException: Incorrect syntax near '='」という構文エラーが発生し、その内容がわかりません。
これが私のコードです
cmd = new SqlCommand("Select Submission_Attachment as Path from Tasks where Submission_FileName =" + FileName, con);
reader = cmd.ExecuteReader();
while (reader.Read())
{
FilePath = reader["Path"].ToString();
TextBox1.Text = FilePath;
}
reader = cmd.ExecuteReader();にエラーが表示されます。