P. 1
Database

Database

|Views: 1|Likes:
Published by Bzasri Rao
VB programming
VB programming

More info:

Published by: Bzasri Rao on Mar 20, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

03/20/2013

pdf

text

original

1. 2.

Private Sub Command1_Clic ()

'Shows how to create an Access 2000 database and append tables, fields, in dexes using ADOX. Don't forget 3. 'a reference to ADOX (Microsoft ADO Ext. 2.x for DDL and Security) 4. Dim ADOXcatalog As New ADOX.Catalog 5. Dim ADOXtable As New Table 6. Dim ADOXindex As New ADOX.Index 7. 8. On Error GoTo errhandler 9. ADOXcatalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "c: \newdata.mdb" 10. 11. On Error Resume Next 12. 13. ADOXcatalog.ActiveConnection = _ 14. "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _ 15. & "c:\newdata.mdb" 16. 17. 'name table, append fields to table 18. ADOXtable.Name = "Employees" 19. ADOXtable.Columns.Append "LastName", adVarWChar, 40 20. ADOXtable.Columns.Append "ID", adInteger 21. ADOXtable.Columns.Append "Department", adVarWChar, 20 22. 23. 'append tables to database 24. ADOXcatalog.Tables.Append ADOXtable 25. 26. 27. 'internal index on two fields 28. ADOXindex.Name = "TwoColumnsIndex" 'name of index 29. ADOXindex.Columns.Append "LastName" 30. ADOXindex.Columns.Append "ID" 31. 32. ADOXtable.Indexes.Append ADOXindex

Number <> 0 Then 37. operation not complete" 38. End Sub .Description & ". Set ADOXcatalog = Nothing 42. Set ADOXindex = Nothing 41.33. If Err. errhandler: 34. MsgBox "Err " & Err. MsgBox "Database already exists" 36. ElseIf Err. End If 39.Number = -2147217897 Then 35. Set ADOXtable = Nothing 40.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->