Few questions about databases.

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Hi there,

I have played with databases in vb.net a while ago - but to be honest, i didnt really know what i was doing and i was just playing around with it until i got it to work.

I want to learn how to use them properly now as i am sure its a skill i would need in the future.

I have read the sticky on paramaterized queries and that makes sense -sorta.

I have also read the sticky on datasets and data adapters. Does the "flow of data" work this this: You load your program -> It loads the whole database into the dataset -> you do your queries on the dataset -> you send the dataset back the database to sync - correct?

What does ADO.NET stand for?
Is there another way/form of database access in .NET?

With regards to the use of primary/foreign keys - why do you use them and do you have to use extra code to use them properly/get the advantages? I understand the point that it removes the "redundant data" where you have multiple entries of the same thing, but surely you would have to query two tables to get all your data. Or is there a way you can like query once to get everything?

Is there a good tutorial that will start from the begining of setting up and using databases via code, rather than visually via binding controls etc....?

Thanks for any input.
 
Last edited:
Does the "flow of data" work this this: You load your program -> It loads the whole database into the dataset -> you do your queries on the dataset -> you send the dataset back the database to sync - correct?
nOo.. thats just silly. Microsoft spend millions writing SQL Server to be the fastest, best, analytically processing, analyzing, hashing, flexible database ever and intend for it to run on dedicated servers with 10 CPUs, 32 gigs of ram and more hard disks than you can shake a stick at..
Does it really make sense to download 500000000000 records out of it, into some scratty, limited, client side code running on a 256mb pentium 3? No, because doing that would make your beautiful server that cost half a million dollars, into a glorified file server.

What does ADO.NET stand for?
ActiveX Data Objects .NET

.NET is short for "a suite of technology representing the salvation of millions of dollars in R&D into java that was mooted when java's creator successfully sued microsoft for violation of the provision agreement of the platform"


Is there another way/form of database access in .NET?
Thats kinda like asking if there's a way round using a driver for your video card; yes, but why would you bother?


With regards to the use of primary/foreign keys - why do you use them and do you have to use extra code to use them properly/get the advantages?
Read a relevant Wikipedia article on database design goals

I understand the point that it removes the "redundant data"
PK in themselves remove nothing; they imply a constraint that no two cells may take the same value, but this in itself is not active removal of data

where you have multiple entries of the same thing
Youre talking about normalisation now

but surely you would have to query two tables to get all your data.
Yes. Databases have hundreds or thousands of tables; would you prefer just one?


Or is there a way you can like query once to get everything?
Read about JOINs

Is there a good tutorial that will start from the begining of setting up and using databases via code, rather than visually via binding controls etc....?
That's kinda like asking if there is a good guide to making a cup of tea, that includes instructions on how to grow a tea plant, how to pulp the paper to make the teabag, how to form the cup out of clay and fire and glaze it, how to build a kettle.. Should I go on? The cup, teabag and kettle are provided for you. WHy would you want to deliberately go and make life harder for yourself? You arent going to learn anything essential. If youre really curious to see all the code that goes behind database access, you can.. but there's a good reason why it is written by a wizard and hidden; it is lengthy, repetitive and boring. Computers excel at doing lengthy repetitive boring tasks and the wizard makes this code in seconds. If I gave you a week, you could not do a better job, I promise.

Walk before you run. Understand databases, SQL, and visually designing apps that use databases. You'll do yourself no favours tinkering under the hood right now, youll jsut take a long time to write bad code.
 
Back
Top