473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access with ADOX

Hi all,
I am using this code to create a Access Database.
Expand|Select|Wrap|Line Numbers
  1. 'Mark Reference to 
  2. 'Microsoft ADO Ext.2.8 for DDL and Security
  3. 'From the COM tab
  4. Public Shared Function CreateDatabase(ByVal DatabasePath As String, Optional ByVal DatabaseType As JetEngineTypes = JetEngineTypes.Jet4X) As Boolean
  5.  
  6.         Dim adocat As ADOX.Catalog
  7.         Dim con As String
  8.  
  9.         adocat = New ADOX.Catalog
  10.  
  11.         con = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=" & DatabaseType & ";Data Source = " & DatabasePath
  12.  
  13.         Try
  14.             Call adocat.Create(con)
  15.             m_objadoCatalog = adocat
  16.             Return True
  17.         Catch
  18.             Return False
  19.         Finally
  20.             adocat = Nothing
  21.         End Try
  22.     End Function
  23.  
Now I want to add a Password to the database.How can I do this

Thanks in Advance
Dana
Jun 8 '07 #1
2 1243
No Problem. I found the answer.Here is the Full code
Expand|Select|Wrap|Line Numbers
  1. 'Mark Reference to 
  2. 'Microsoft ADO Ext.2.8 for DDL and Security
  3. 'From the COM tab
  4. Public Shared Function CreateDatabase(ByVal DatabasePath As String, Optional ByVal DatabaseType As JetEngineTypes = JetEngineTypes.Jet4X) As Boolean
  5.  
  6.         Dim adocat As ADOX.Catalog
  7.         Dim con As String
  8.  
  9.         adocat = New ADOX.Catalog
  10.  
  11.         con = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=" & DatabaseType & ";Data Source = " & DatabasePath & ";Jet OLEDB:Database Password=test"
  12.         Try
  13.             Call adocat.Create(con)
  14.             m_objadoCatalog = adocat
  15.             Return True
  16.         Catch
  17.             Return False
  18.         Finally
  19.             adocat = Nothing
  20.         End Try
  21.     End Function
  22.  
Jun 8 '07 #2
kenobewan
4,871 Expert 4TB
Well done! Thanks for sharing the solution :).
Jun 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Job Lot | last post by:
Is there any way to programmatically link access tables using vb.net
41
by: Ruby Tuesday | last post by:
Hi, I was wondering if expert can give me some lite to convert my word table into access database. Note: within each cell of my word table(s), some has multi-line data in it. In addition, there...
2
by: Tom Loach | last post by:
After reviewing the messages on google and using the Access 2000 developers handbook I came up with the following code to add a field to an access table. I'm working in Access 2002, and the code...
6
by: Null Reference | last post by:
Anybody here who can explain or point me to a link ? I wish to create a blank MS Access DB file programmatically using C# . Thanks, nfs
11
by: DraguVaso | last post by:
Hi, I want to make a small application in VB.NET that relinks all the query's and tables in an Access database that are linked via ODBC to an SQL Server. It must be able to relink all the tables...
12
by: Art | last post by:
Hi everyone I was hoping someone might be able to help me with this. I'm just starting to try to work with MS Access tables through VB.net. In Access I can take an existing table and add a new...
2
by: Randy | last post by:
I am trying to relink some Oracle tables in an Access database via VB.NET and ADOX. I receive the following error when executing the cat.ActiveConnection link "Arguments are of the wrong type,...
1
by: sunlight_sg | last post by:
Hello, i am using ADOX + VB .NET to create a Access Database programmatically. I plan to set some properties of the column such primary key. The code is as follows: Dim cat As ADOX.Catalog...
2
by: balaki | last post by:
Hi All, I am using VB.Net 2003 and Ms-Access 2003. I want to change the data type of fileds programmatically. I could not find any method in vb.net to do this. i) I tried using the sql query...
3
by: Iain King | last post by:
I'm manipulating an MS Access db via ADODB with win32com.client. I want to rename a field within a table, but I don't know how to. I assume there is a line of SQL which will do it, but nothing...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.