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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a database from scratch with VB6? 1

Status
Not open for further replies.

tyhand

Programmer
Jul 3, 2002
186
US
Hey all,

I'm trying to create an app with VB6 that requires the creation of a database, tables, etc. for a Windows XP environment and above AND regardless of whether or not the end user has MS Access.

I've worked with databases before via PHP/MySQL so I know certain concepts. Also, my skill level with vb6 is ok; but I've never done anything with databases.

I've come across several tutorials discussing creation of a database via code such as the following:

'Dim catNewDB ' As ADOX.Catalog
Dim catNewDB As Object
'Set catNewDB = Server.CreateObject("ADOX.Catalog")'... etc.

However, I'm not quite understanding the concept of DB creation using VB6. I know there's a CreateDatabase Method that creates a database object; but I'm not sure how it ties into creating the elements of a database and inputting data.

Can anyone point me in the right direction as to how to create a database with vb6 from scratch? Or, at least, give me the 'quick and dirty'?

Any and all help is greatly appreciated.

Peace!
- Thank You Have A Nice Day
 
You may want to 're-think' WHY you need to create a new database. Often times it is easier to distribute a blank database with your application. Every time you need a 'new' database, simply copy the blank database to a new file named whatever you like. You suddenly have a new database with the tables already created and you could even have data in some tables (think look up tables).

Copying a file to create a new database is a lot easier this way.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 

Thanks vb5!

Read your comments on post #13 about how MS forgot to include CreateDatabase method -- funny : ))

BTW, can you also recommend any online tutorials for database development concepts with VB6?

Thanks again.

- Tyhand

 
There really should not be any "database development concepts with vb6" tutorials out there because a database and any programming language are two different beasts.

Database development and design is a beast of its own with its own rules, strategies, and concepts for it to reach its optimal performance, and this has nothing to do with any programming language. It is meant to hold data, relational or otherwise, in the most efficient way it can based upon the design of the database.

Each DBMS has its own pluses and minuses but what they do have in common is the SQL language (pronounced Sequel). SQL has a syntax of its own, like VB or C++, that allows you not only to access, add, edit, and delete data stored within the database, but to alter the structure of the database itself and it is up to the DBMS to interpret these commands and execute them to the best of its abilities.

Then each DBMS has its own protocols for receiving these commands and sending any results of executing those commands, and while those interfaces follow the same rules, each is just a little bit different. That is why each DBMS has a set of drivers or dlls that do have a common interface and it is this interface that programming languages like VB access when they use DAO, RDO, or ADO. This common interface can be found, at least visually, with the ODBC DSN Administrator/manager.

Speaking of ADO, ADO is a wrapper for both RDO and DAO to give the VB programmer a common interface because back in the day before ADO, one had to change their code from DAO to RDO depending upon if they were accessing Access or M$'s SQL Server. That is unless one used either DAO ODBC Direct, or RDO with an ODBC DSN as RDO. Then just a note of history, RDO has the same ability to use a DSN Less connection string as ADO. Where do you think ADO got that ability from?

So, here at the end of this longish post, is the advice to search for SQL tutorials, and you will find some out there with "programming language name SQL Tutorial" (VB6 SQL Tutorial) and even more with vb6 ADO Tutorial as one must know at least a little SQL to access the data stored in the database of choice. Then for database development there are keyword phrases like 3rd normal form, database design (you could also add the keyword concepts to each of those), and of course you could get specific with DBMS name design concepts (Access design concepts, SQL Server design concepts).



Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top