PDA

Click to See Complete Forum and Search --> : SQL help!!!


Dino
Nov 2nd, 2000, 01:57 AM
LS

Is there anybody who can help me with some simple SQL-questions? I've never done anything with SQL but I need to build an app with a database (MS access).
Can you tell me how to create a database, read from the database (showing the result) and write (the result) to the database with SQL statements?
And more important how to use them in VB(6).
Thanks!!!

paulw
Nov 2nd, 2000, 04:35 AM
This is much too broad a question - it partly depends on what Database Engine you are using.

Assuming Access (Jet 4) you could use the CreateDatabase command - the actual command depend on whether you use ADO or DAO - ADO is the future so if you do not know either, learn that. This will merely create the file - you will stillneed to create all the tables etc.

To create the tables you would use CREATE TABLE...

To read data from tables you would use the SELECT... form and to put data into a table you would use INSERT...

Check out the Access Help on CREATE TABLE; SELECT and INSERT SQL commands.

You really need a basic primer in SQL and you need to get to know the Database Engine that you will use. There are some good primers on VBWorld.

Good Luck

Paul.

Dino
Nov 2nd, 2000, 05:04 PM
Paul,

Thanks for the fast reply. Your answer brought up even more questions. Is it possible to give me some advise in this matter? I´m an absolute beginner with databases. The only `database` I´ve ever used is the windows registry.
You sound Dutch to me, I´m I right?

- D -

paulw
Nov 3rd, 2000, 03:38 AM
Hi Dino,

I'm not Dutch but I work for a Dutch bank. I'm ENGLISH!!!

If you have never worked with a database before you really need to get a basic primer that you can read at your leisure. Playing around with Access is a good start (as is getting on VB-World :) but you cannot beat a good book. How about Access for Dummies - it is a good, CHEAP, basic primer and you should whip through it.

In Access you create a New database form File...New Database...

You can then design your tables and once you have them the wizards will take you through query design. I strongly suggest you look at the NWIND.MDB example database that comes with Access - I didn't for about four years and was amazed at what I had missed.

I would say that the most important thing is to have a clear idea of your data and how it will split down into tables. Write it out on paper first and then play around - you can re-create tables easily in Access so do not be afraid of making mistakes.

Best of luck,

Cheers,

Paul.