SQL Connection help

L

lemonpillows

I'm a complete newbie to Visual Studio. I'm using C#, Sql Server and
have a copy of web matrix.

How the heck do I connect to a database??? All I want to do, is connect
to the SQL database I've set up on my local machine, and read the info
from the tables to a grid on my page.

I've done the 'dragging the connection onto the page' thing fine. But
where do I go from here? I know I've got to write some code, but I have
no idea exactly what I have to write, which document to write it in
(global? web.config? aspx.cs?) and whereabouts in the document to put
it.

I know that under the 'page load' bit, I need to put my Sql statement.
Sql syntax is no problem. I'm confused between 'SqlConnection',
'myConnection', 'myCommand', and CommandText'. I'm not sure which I have
to rename, or which I leave as it is... Can you see how confused I am??

I've been trying for days, and all the articles seem to be on VB.net.
Can anyone help me? Or point me in the direction of a newbie-friendly
tutorial? (for a very frustrated-about to trash the computer Masters
Student) :blush:(

Thanks for your time,

lemonpillows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top