The problem with the Nikon D40 is there's no lens motor in body means which non-AF-S/AF-I lenses are manual focus only
RAW+JPEG setting only records Basic quality JPEG's. No exposure or white balance bracketing.
If you want to go the Nikon route then the D80 is the way to go.
Of the two mentioned there is no contest the Canon 450D is the one to go for. this will take the full range of lenses and also comes with Live View.
Check it out click here. you could also check out the D40