Database access....

Project X

Expert Member
Joined
May 16, 2006
Messages
1,615
Reaction score
1
Can anyone please help me create a database in access..

Im thinking off doing something like a CD database where you select an artist from a drop down menu and then it shows you all the artists CD. thne after selecting a CD it should display all the songs on that particular Cd with information about the CD.
 
Well, what help do you need? You would probably need 3 tables, at least, with the following fields:
Artist
- ArtistId (PK, Autonumber)
- ArtistName (string)
CD
- CDId (PK, Autonumber)
- ArtistId (FK)
- CDName (string)
- Year (integer)
Song
- SongId (PK, Autonumber)
- CDId (FK)
- SongName (string)
- SongLength (string / decimal)
 
Well, what help do you need? You would probably need 3 tables, at least, with the following fields:
Artist
- ArtistId (PK, Autonumber)
- ArtistName (string)
CD
- CDId (PK, Autonumber)
- ArtistId (FK)
- CDName (string)
- Year (integer)
Song
- SongId (PK, Autonumber)
- CDId (FK)
- SongName (string)
- SongLength (string / decimal)

+1
 
Maybe add Genre to either the Artist or CD tables.
 
OK thanks... that helps.
Once this is done wont it be hard making it work on Delphi?
 
You can use the Acces DB's tables in various languages, but for something like what you want to do, it would probably best creating a complete Access application...
 
To answer the question, Delphi would be reasonably simple - use the data access wizards for a simple layout, and tweak from there.

Alternatively, download C# 2008 Express Edition and use that - very easy to get up and running with that too.
 
Hi

Ok here is the deal...

I'm am creating an application as a school project and this app needs to include the use of a database and Delphi.
Now what my app does is reads some CD DB then I can search delte etc..
the problem is I created 3 forms(which means 3 units) so that's 3 units and forms under one project.

now my prob is :

1) I cant link unit 3 to unit 2. I need to do this because all the adotable,DBgrid etc are of form 2(unit2) now im using form 3(unit3) as a pop up menu, that will enable me to add new records to the DB but it keeps saying "Undeclared Identifier" please help me with the class stuff im very new to it.

2) I'm pretending that the app is for a Music store.. So I want it to be able to record the amount off CD's the store bought and save them in the database then subtracted them each time a user buys one. for that I could use a maybe a "purchase button" but I don't know what to code there.

3) My 1st form is the welcome page which asks for a password,and there is a close bitbotton that works fine. then on my 2nd form where the actual DB displays are the close bitbtn there only closes form2's unit and not the whole App which is what i want it to do.

Please help me with all 3 Qzz :-)
 
I don't have much experience with Databases in Delphi but if possible use SQL instead of Access.

I've used M$ Access Databases in some of my modules because we had no other choice and all I have to say is Access is total POS, use the proper thing ;)

M$ SQL Server and MySQL are both great, SQL Server is really awesome and the express edition is free on the other hand MySQL is also really awesome. Win win either way :p

Goodluck with the project!
 
Thats the thing i have to use access.
Ok could you help me with the delphi side then,linking the 3 units.
 
Database Servers offers more than MSAccess, but for a school project I will stick to Access for ease of use. Moving a singe file around (school - home - teacherPC) is more practical.
 
Did you add "uses form2" (or whatever the name of the form in unit2) in the implementation part of unit3?

Then you will be able to do form2.dbgrid.whatever or form2.adotable.whatever in unit3.
 
Last edited:
Did you add "uses form2" (or whatever the name of the form in unit2) in the implementation part of unit3?

Then you will be able to do form2.dbgrid.whatever or form2.adotable.whatever in unit3.
Yes i did


Pm sent
 
Yes i did


Pm sent

Sent one back. Hope it helps.


RE: Question 3...
I see u use Application.Terminate.
Another option is to close your main form (frmMusic) from the other units. Closing the main form will terminate the program.
Include unit1 (MyMusic_u) in the other units and close like this:
frmMusic.Close.
 
Question 2: Add Quantity to the CD table and subtract every time someone buys a CD.
 
Yes.

When someone buys a CD, read the current quantity value from the table and subtract one. Save the new value.
 
ok this is my code for my button that is supposed to subtract the quantity of the album in focus.
var
iQuan,iSub : integer;

begin
iQuan := sedQuan.Value;
ADOMusic['Quantity'] := iQuan;
iSub := iQuan -1;
ADOMusic['Quantity'] := (iSub);

But it is not working what am i doing wrong?
 
ok guys here is my new code
var
iMusic,iQuan,iSub : integer;

begin
iQuan := sedQuan.Value;
ADOMusic['Quantity'] := iMusic;
iSub := iMusic-iQuan;
redMusic.lines.add('You have purchased' + IntToStr(iQuan) + 'Copy of' + AdoMusic['Artist']);
ADOMusic['Quantity'] := (iSub);
but when i try to press the button i get this error
Dataset not in edit or Insert Mode
please help
 
Top
Sign up to the MyBroadband newsletter
X