R
Roy Soltoff
I am porting a project from VB6 to Net 2.0. One part of the project used
ADOX 2.7 to create a Jet 4.0 database and various tables. In some of the
tables, there are TEXT fields that are allowed to be empty. In VB6, a
statement of the form,
Col.Properties("Jet OLEDB:Allow Zero Length")=True
would do the job.
Using an imported ADOX reference, the Properties collection is ReadOnly and
no Add method is available. Thus, there appears to be no way to set a text
field to allow it to be empty.
Looking at the mechanism in using SQL and CREATE TABLE..., that also does
not seem to provide any means of setting the AllowZeroLength properyty of a
field to True.
Anyone come up with a DotNet way of accomplishing this? Following is an
exact partial set of statements used in the VB6 project - and obviously
without access to setting the properties, making a column AutoIncrement
would be impossible (JETAZL is a constant of the above mentioned string):
Set Tbl = New ADOX.Table
With Tbl
.Name = "Content"
Set .ParentCatalog = Cat
With .Columns
.Append "TrackingID", adInteger
With .Item(.Count - 1)
.Properties("AutoIncrement") = True
End With
.Append "RequestID", adVarWChar, 12
With .Item(.Count - 1)
.Properties(JETAZL) = True
End With
ADOX 2.7 to create a Jet 4.0 database and various tables. In some of the
tables, there are TEXT fields that are allowed to be empty. In VB6, a
statement of the form,
Col.Properties("Jet OLEDB:Allow Zero Length")=True
would do the job.
Using an imported ADOX reference, the Properties collection is ReadOnly and
no Add method is available. Thus, there appears to be no way to set a text
field to allow it to be empty.
Looking at the mechanism in using SQL and CREATE TABLE..., that also does
not seem to provide any means of setting the AllowZeroLength properyty of a
field to True.
Anyone come up with a DotNet way of accomplishing this? Following is an
exact partial set of statements used in the VB6 project - and obviously
without access to setting the properties, making a column AutoIncrement
would be impossible (JETAZL is a constant of the above mentioned string):
Set Tbl = New ADOX.Table
With Tbl
.Name = "Content"
Set .ParentCatalog = Cat
With .Columns
.Append "TrackingID", adInteger
With .Item(.Count - 1)
.Properties("AutoIncrement") = True
End With
.Append "RequestID", adVarWChar, 12
With .Item(.Count - 1)
.Properties(JETAZL) = True
End With