New to asp. Problems connecting to database. Not sure about correct method to use
<p>I've been using asp forms for the past week or so. Mostly I've been getting used to gridview and using the site.master to display menus on each page and using the connectionstring in web.config to access my sql server database.</p>

<p>But I'm not finding gridview all that versatile and am a little confused as to how this is all supposed to work. I've come from PHP and ASP seems a world different. What I want to do is to loop a table and print out records but i want to use my own loop and not gridview so i can have custom columns as well. so i can create dynamic links with different gets and things like that. In PHP there was syntax to connect to the DB, write the loop and then print the html inside it by echoing or something like that.</p>

<p>In aspx I am using C# as my language so am I to understand that i literally write c# code in between &lt;% --code-- %> for this to happen</p>

<p>So asp is basically an abiltiy to script using c# or VB</p>

<p>Lastly should I write the DB connection in code behinds Page_load or just at the top of the aspx file...</p>

<p>Sorry about the newbie question, I would really appreciate being pointed to a suitable tutorial as well which explains all this if anyone can help. I found the w3schools stuff which I usually use to be quite confusing.</p>
