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

How create a new database using vbscript?

Status
Not open for further replies.

seidel

Programmer
Oct 23, 2002
10
MX
Hello!, How create a new database using vbscript, but with input user on filename?

Please helpme!
thanks
 
What type of database? MS Access, SQL Server, other?

Some ways are below:

==== MS Access ====
Create a standard blank MS Access MDB file, named "DEFAULT.MDB"
When ready to create a new database, copy the "DEFAULT.MDB" file to the filename that the user provided, then use this database accordingly.


==== SQL Server ====
Whatever application/script you're using needs to have permissions to create databases on the server. Then simply call the CREATE DATABASE commands with your user-provided name, and any options you want, and use this database accordingly.

Hope it helps.
 
many thanks for your advice!, I need create an access database.

thanks
 
Use ADOX,

SET oCat = CreateObject("ADOX.Catalog")
oCat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ADOX.mdb"
oCat.ActiveConnection.Close
SET oCat = Nothing

or automate Access if it's installed,

SET oAccess = CreateObject("Access.Application")
oAccess.NewCurrentDatabase "C:\Access.mdb"
oAccess.CloseCurrentDatabase
oAccess.Quit
SET oAccess = Nothing Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top