[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to create a database

Posted on 2002-07-27
6
Medium Priority
?
138 Views
Last Modified: 2010-05-02
1. How to create & Open a database with database password
   in Jet Database ( Using ADO)

2. How to create & Open a database with database password
   in SQL-Server ( Using ADO)

thanks in advance

0
Comment
Question by:ackid32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
jayeshshah earned 900 total points
ID: 7181744
1.
for Creating Databases in Access you can use ADOX as shown below

Dim Cat As New ADOX.Catalog        
Cat.Create "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & Str_Path '' (where database has to be made)
Cat.ActiveConnection.Close

for using the above code you have to add an reference to Microsoft ADO Ext. 2.1 for DDL and Security.

2.
For SQL Server below is the code
Dim Cn as new Adodb.Connection
Cn.Connectionstring = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=;Data Source=" & SQL Server Name.
cn.open

cn.execute "Create database " &  new database name

0
 

Author Comment

by:ackid32
ID: 7181852
dear jayesh

i know how to create these databases but not with DATABASE PASSWORD

i want that.
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7181906
try putting the password field in the Create statement.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:hongjun
ID: 7181962
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7181963
sorry CreateDatabase is not a sql syntax!!! It is a method!

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7181964
http://www.mvps.org/access/modules/mdl0036.htm

************* Code Start *****************
Function foo()
   Dim db As Database
   Dim oAcc As Access.Application

   Const TMP = "fooz.mdb"

   Set db = DBEngine.CreateDatabase(TMP, _
                       dbLangGeneral)
   db.NewPassword "", "doooo"
   db.Close
   Set db = Nothing

   Set oAcc = New Access.Application
   Set db = oAcc.DBEngine.OpenDatabase(TMP, _
                           False, False, ";PWD=doooo")
   oAcc.OpenCurrentDatabase TMP
   db.Close
   Set db = Nothing
End Function


hongjun
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question