On 21 Jul 2004 09:06:52 -0500, (e-mail address removed)-spam.invalid (joejohnsonwall)
wrote:
¤ Initially it will be Access as all the computers on our network have
¤ Access. We have a server with SQL2000 as required by a product our
¤ facility bought, then dumped after 1 1/2 years. I approached our
¤ system folks about being granted access to that server so I could use
¤ that system and develop my skills, but was turned down. My thoughts
¤ at this point are to develop an Access system which will serve well
¤ to develop my ADO.NET skills. Once I can show a usable, helpful
¤ system using Access to my superiors, I expect I will be in a position
¤ to have them talk to the system folks about the SQL server with
¤ SQL2000.
¤ Anyway, my plan is that on start-up, the system will check the
¤ registry for the location of the database. If there is no registry
¤ entry, or if the file does not exist where it is supposed to be, the
¤ program should offer the user the option of creating the database.
For Access you still need to use COM ADOX (Microsoft ADO Ext 2.0 for DDL and Security) to create the
database. You can use Access DDL or ADOX to create Tables:
Dim tbl As New ADOX.Table
Dim col As New ADOX.Column
Dim cat As New ADOX.Catalog
'Engine Type=4 is Access 97 and a value of 5 is Access 2000
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db13.mdb;" & _
"Jet OLEDB:Engine Type=4;")
tbl.Name = "NewTable"
col.Name = "AutoField"
col.Type = ADOX.DataTypeEnum.adInteger
col.ParentCatalog = cat
col.Properties("AutoIncrement").Value = True
tbl.Columns.Append(col)
col = New ADOX.Column
col.Name = "DateField"
col.Type = ADOX.DataTypeEnum.adDate
tbl.Columns.Append(col)
col = New ADOX.Column
col.Name = "Address2"
col.Type = ADOX.DataTypeEnum.adVarWChar
col.DefinedSize = 20
col.Attributes = ADOX.ColumnAttributesEnum.adColNullable
tbl.Columns.Append(col)
col = New ADOX.Column
col.Name = "Age"
col.Type = ADOX.DataTypeEnum.adInteger
col.Attributes = ADOX.ColumnAttributesEnum.adColNullable
tbl.Columns.Append(col)
cat.Tables.Append(tbl)
cat.Tables("NewTable").Columns("Address2").Properties("Jet OLEDB:Allow Zero Length").Value =
True
cat.ActiveConnection.Close()
Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)