The
GridFile.SelectedRows[0].Cells[0].Value
part is
inside the quotes, so it gets treated as a part of the query. You have to close the quotes before the
+
operator.
However, string concatenation for SQL queries is a bad idea: you're vulnerable for
SQL injection[
^]. Use parameterized queries instead: they fix the vulnerability and make your query more readable.
SqlStr = "Delete from FilelibF where IdAttachBord = @SelectedCell";
sqlcmd = new SqlCommand(SqlStr, cn);
sqlcmd.Parameters.Add(new SqlParameter("SelectedCell", GridFile.SelectedRows[0].Cells[0].Value));
sqlcmd.ExecuteNonQuery();