VisualStudio.net asp.net and DB question

G

Guest

can anyone out there give me a little advice concerning the common way to add
database queries to a form? I'm doing it manually now, but it appears that it
can be done /w drag and drop. So far the result is just way too confusing. Is
there an artical or book that can help me get the most out of
VisualStudio.net?
Thank you!!!
kes
 
J

Jeppe Dige Jespersen

can anyone out there give me a little advice concerning the common way to
add
database queries to a form? I'm doing it manually now, but it appears that
it
can be done /w drag and drop. So far the result is just way too confusing.

Well, I think you _do_ need to understand the concepts of data connectivity,
but once you get familiar with it, all the wizard- and dragdrop-stuff makes
pretty good sense.

Look into these classes, and how they interact:

Connection (sqlConnection for sql-server, otherwise mostly oledbConnection)
DataAdapter (sqlDataAdapter/oledbDataAdapter)
Dataset

Once you get familiar with them, you can drag and drop tables/fields from
the Server Explorer, and the connection and dataAdapter will be created for
you.

But.... first do some reading up on the subject. It might take a few days,
maybe even a couple of weeks, to get real comfortable with ado.net, but
there is method to the ado.net madness. You will see the light :)

This is a good place to start:
http://msdn.microsoft.com/data/DataAccess/adonet/default.aspx

Jeppe Jespersen
 
G

Guest

Thanks for your help

I have looked at the classes and i'm doing the coding by hand. the
connectivity is fairly basic, but VisualStudio.Net creates subroutines that i
don't understand very well. I guess what i'm asking for is a step by step
example of drag and drop and how the created sub's interact. say for the
following:
new form with a datalist.
1. which should get created first the datalist or the OleDbConnection or (?)
2. when a connection is dragged onto a page. what is created and what needs
to be modified?
thanks
kes
 
J

Jeppe Dige Jespersen

1. which should get created first the datalist or the OleDbConnection or (?)
2. when a connection is dragged onto a page. what is created and what needs
to be modified?

1. If you add both the datalist and the connection at design time, it
doesn't matter much which one you add first. However, some properties on the
datalist can't be set until you have data components added.

2. First off, I would use Server Explorer (CTRL-ALT-S) to drill down into my
database, and then drag the _tables_ directly to my form. This automatically
creates a connection and a dataAdapter (one for each dragged table), and
then all you need is to add a dataset. To do this, right-click the adapter,
and pick "Generate Dataset".

3. Once you have the dataset, you can set databinding properties on, say, a
datalist. Then, when the form runs (form_load event) you can call the "fill"
method on the adapter, then the "databind" method on your datalist, and you
should see data in the list.

....maybe... :)

Jeppe Jespersen
 
G

Guest

Thanks this is a help and it was what i was looking for!
It may have seemed simple to you, but it was jsut the sort of thing i need
to prime the pump.
thanks
kes
 
J

Jeppe Dige Jespersen

It may have seemed simple to you, but it was jsut the sort of thing i need
to prime the pump.

If it's any comfort, this did not seem simple to me just a few months ago.

Keep at it. :)
Jeppe
 
G

Guest

Thanks you it is a comfort! I've been a programmer since the early 80's on
every thing from rpg,II,III,400 to IBM(360/370) Macro ASM - SQL before it
was called that. And i've done it all not because i'm a great thinker, but
just because i'm plain stubborn.
Yes It is a GREAT Comfort!!!!
kes IOU1
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top