How can I do this task:
a) via code
b) via designer mode (if this possible)
Thanx!
¤ Hello, Experts!
You can add the ADOX to your VB.NET project to do this:
Private Sub CreateAccess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles CreateAccess.Click
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=d:\My Documents\db10.mdb;" & _
"Jet OLEDB:Engine Type=4;")
tbl.Name = "NewTable"
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
End Sub
Paul ~~~ pcle...@ameritech.net
Microsoft MVP (Visual Basic)