We suggest you use the new razor tutorial to learn how to do these things. This old tutorial still demos some edge cases not described there, which is why we still provide it.
Try the various views in this App to discover how we access SQL data with the following variations:
Have fun :)
If this is the first time you've seen DNN-Apps and would like to try one - just install 2sxc first, then install this app inside it.