Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating tables with relationships: in VBcode or SQL?

Status
Not open for further replies.

ChrisMacPherson

Programmer
Jul 3, 2000
157
GB
Bit of a newbie question here.

I am making a database app. which will store companies details. I am designing the front end in VB and would like to create some tables with relationships as well. I have read lots about it and have discovered (I think) a few different ways of doing this.

I have figured out how to use the VisData manager to create the tables and keys, but how do I create the relationships between the tables once this is done?

The other way I have found(which I think might be better) is to create the tables etc. in SQL itself.

Another problem is, that when I code the app. to create the database, I will want it to save the database at the end, and not create a new database everytime the app. runs.
Would I just enter the database creation code in to a 'NEW DATABASE' option, and just connect to an existing database on startup? If so how do I link the tables with relationships when I connect to a database.

I hope this is a sensible question as I am quite confused on this matter!

Thanks for any help..

Chris MacPherson
thedamager@hotmail.com
Bring on the new Browza's!!

Learn/t/ing D\HTML, Javascript, Java, VB5-6, COBOL, Pascal
 
Depends on what DB you are using. If you are back-ending with Access then use Access itself, if SQL Server or Oracle then use the SQl in the database or some third party designer tool, or the ones shipped with it. They are usually quite good.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Whichever db you're accessing it's best to use that database's client tools to do your relationships & tables

For example. RDMS' like Informix,Sql Server, Oracle,DB2 all have their own client software that you launch & use to create your tables, relationships etc.
If you connecting to Microsoft Access for example it's best to use Microsoft Access to create your db, stored queries, relationships (does this graphically -drag/drop).

VisData is a nice addin to have on your side. Unfortunately not much work was done on it hence the source was prvided so that if you want an modifications you can do it yourself.
There's actually quite a no of bugs in visdata & I admit it's probably the best starting place when you get into db apps but it's just an addin. :)

It's probably best to create your db first before you start coding a single line.
It's probably best to design your app before creating your database.

Once your db is created you just open it from within your vb code (Many methods exist to so this.)
If your db is created properly you'd probably not need temporary tables (even for reporting) so I would avoid creating any tables at run-time especially in a multi-user environment.

So in closing it's best practice to design your db, tables & relationships before you write any code & not at run-time & then just to connect to your db/datasrc at run-time.

Hope this helps
caf


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top