|
-
Aug 13th, 2001, 09:12 PM
#1
Thread Starter
Fanatic Member
ADOX Question
I have used ADOX to create a new database
It works fine and the new db is built
owever I have done nothing with setting security on the database
and when I go to open this new db in access so I can verify all the tables are correct It prompts me for a username and password
does anyone know how to prevent this from happening?
-
Aug 13th, 2001, 09:33 PM
#2
PowerPoster
How do you create the db?
-
Aug 13th, 2001, 09:38 PM
#3
Thread Starter
Fanatic Member
This is the code
VB Code:
Public Function CreateDB(strPath As String) As Boolean
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
'On Error GoTo errorHandler
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
cat.Create "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & strPath
With tbl
.Name = "Clients"
.Columns.Append "User", adVarWChar, 50
.Columns.Append "IP", adVarWChar, 16
End With
cat.Tables.Append tbl
Set tbl = Nothing
Set tbl = New ADOX.Table
With tbl
.Name = "Data"
.Columns.Append "Path", adVarWChar, 250
.Columns.Append "Name", adVarWChar, 250
.Columns.Append "Exe", adVarWChar, 250
End With
cat.Tables.Append tbl
Set tbl = Nothing
Set tbl = New ADOX.Table
With tbl
.Name = "Office"
.Columns.Append "Username", adVarWChar, 250
.Columns.Append "Password", adVarWChar, 250
.Columns.Append "Num", adInteger
End With
cat.Tables.Append tbl
Set tbl = Nothing
Set tbl = New ADOX.Table
With tbl
.Name = "Teachers"
.Columns.Append "Username", adVarWChar, 250
.Columns.Append "Password", adVarWChar, 250
.Columns.Append "Num", adInteger
End With
cat.Tables.Append tbl
Set tbl = Nothing
Set tbl = New ADOX.Table
With tbl
.Name = "Students"
.Columns.Append "Username", adVarWChar, 250
.Columns.Append "Password", adVarWChar, 250
.Columns.Append "Num", adInteger
End With
cat.Tables.Append tbl
Set tbl = Nothing
Set tbl = New ADOX.Table
With tbl
.Name = "Settings"
.Columns.Append "School Details", adVarWChar, 250
.Columns.Append "Admin Pass", adVarWChar, 250
.Columns.Append "Internet Pass", adVarWChar, 250
.Columns.Append "Pass Enabled", adBoolean
.Columns.Append "NumLic", adInteger
End With
cat.Tables.Append tbl
CreateDB = True
Exit Function
errorHandler:
CreateDB = False
End Function
-
Aug 13th, 2001, 09:51 PM
#4
PowerPoster
try resetting the catalog with the tbl
-
Aug 13th, 2001, 09:52 PM
#5
PowerPoster
Also at the end of the funstion set cat to nothing!
Your leaving it open!!!
-
Aug 13th, 2001, 10:27 PM
#6
Addicted Member
i think the user is 'admin' and the password is blanc ''.
hth.
calle
-
Aug 13th, 2001, 10:37 PM
#7
PowerPoster
Yep but it shouldnt do that when creating a db in code!
Rudvs2: Hows it going??
-
Aug 14th, 2001, 08:43 PM
#8
Thread Starter
Fanatic Member
Sorry for not responding Beacon I went home for a sleep.
I still havnt got it working
And just to note If i Try to use Admin and blank password to open the db that it creates I just get an unkown user error
Im going to start slogging through MSDN now but if you have had any more thoughts it would be appreciated
-
Aug 14th, 2001, 09:13 PM
#9
PowerPoster
ok this is how i do it. Compare if you need too perhaps that'll help:
Private Sub Command1_Click()
'creating the database.
' create the table
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.mdb"
With tbl
.Name = "Table1"
' Create fields and append them to the
' Columns collection of the new Table object.
With .Columns
.Append "PicID"
.Append "Description", adVarWChar, 255
.Append "Picture", adLongVarBinary
End With
End With
' Add the new Table to the Tables collection of the database.
cat.Tables.Append tbl
Set cat = Nothing
Set tbl = Nothing
MsgBox "Done", vbInformation, "File Created"
End Sub
-
Aug 14th, 2001, 09:58 PM
#10
Thread Starter
Fanatic Member
I think I have found the problem
It appears to be my Access 2000 that is the trouble not my code (whew) because I cant open any databases now without getting prompted for this password
so im just reinstalling
-
Aug 22nd, 2003, 02:42 AM
#11
New Member
I have created a database using ADOX. But now i would like to create a table using user input (text1.text) into the database. How do i open the database using ADOX?
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|