PDA

Click to See Complete Forum and Search --> : Creating a Database


gxpark
Aug 1st, 2000, 06:18 PM
Hi,

I'm a newbie with databases, and I want to know how can I create a new database using ADO...Note that I'm not very familiar with the SQL language...

Thanks!

JHausmann
Aug 1st, 2000, 06:57 PM
What DBMS are you using? SQL Server allows you to send DDL via a TSQL statement that could create a database, as long as the server is defined...

gxpark
Aug 1st, 2000, 07:04 PM
What???

I don't want to be silly, but I didn't really understood what are you talking about...after all, I'm still a newbie :-)

Well, if this helps, I'm using VB6, and ADO 2.5. And I'm working with an Access 2000 database, so no SQL Server. Although I'm aware I must use SQL syntax to use ADO, right?

Thanks for any help!

JHausmann
Aug 1st, 2000, 07:37 PM
T-SQL is TransactSQL, basically an extended version of ANSI-SQL. DDL is Data Description Language, it's what you use to describe/build a database (DML, the other piece of DBMS's, is data manipulation language. Or in simpler terms, queries). You can use DDL in DAO to create an Access database but I'm not sure how you'd do it in ADO.

Clunietp
Aug 1st, 2000, 10:51 PM
Create a database using ADO:

'uses ADO 2.x for DDL and security
Dim strConnectionStringOfNewDB As String
Dim objCat As ADOX.Catalog

'instantiate catalog object
Set objCat = New ADOX.Catalog

'connection string of new db -- includes driver/db type and location
strConnectionStringOfNewDB = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NewDB.mdb"

'create it
objCat.Create strConnectionStringOfNewDB

'cleanup
Set objCat = Nothing

gxpark
Aug 2nd, 2000, 10:12 AM
Hey, thanks a lot!

It works like a charm.

Now, I have a few more questions, but I don't think anyone is going to give me a tutorial about this, so... any good sources to learn ADO? preferably online, because there aren't any good books in my country, and buying them from somewhere else will take long...

thanks again