Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Null columns problem


Message #1 by gbrown@c... on Wed, 9 Jan 2002 17:22:49
Hi all



I've got a routine that creates an access database, the problem is that I 

cannot get it to set the null marker so when I then do ADO insert into 

commands I get errors with data being blank.

The only way I have managed to get this to work is to write code inside 

Access which I would like to get away from.



I've tried this both in ASP and VB (code below is vb)



Have also tried alter table veh alter column col1 NULL; b

but that didn't work either.



Appreciate any pointers.





This is a snippet of the code.



 Set CAT = New ADOX.Catalog

  CAT.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _

             "Data Source=" & path & "\fw.mdb;" & _

             "Jet OLEDB:Database Password=;" & _

             "Jet OLEDB:Engine Type=5;"

Dim TBL As ADOX.Table

  Set TBL = New ADOX.Table

  TBL.Name = "access"

  Set TBL.ParentCatalog = CAT

  TBL.Columns.Append "user_id", adVarWChar, 10

  TBL.Columns("user_id").Attributes = adColNullable

'  ** This failed tbl.Columns.Properties("Set OLEDB:Allow Zero Length")=1

'  ** This failed too  TBL.Columns("user_id").Properties("Jet OLEDB:Allow 

Zero Length") = 1





  CAT.Tables.Append TBL

  Set TBL = Nothing



Regards

Graham



Message #2 by gbrown@c... on Wed, 16 Jan 2002 11:59:46
Answering my own questions here!



If it helps anyone else, the answer appears to be to use DAO *but* ensure 

any connections to the database are closed first as DAO appears to not 

work if it cannot get exclusive use.



HTH someone else, if anybody wants to come back on this with any other 

views then please feel free.



Regards





> Hi all

> 

> I've got a routine that creates an access database, the problem is that 

I 

> cannot get it to set the null marker so when I then do ADO insert into 

> commands I get errors with data being blank.

> The only way I have managed to get this to work is to write code inside 

> Access which I would like to get away from.

> 

> I've tried this both in ASP and VB (code below is vb)

> 

> Have also tried alter table veh alter column col1 NULL; b

> but that didn't work either.

> 

> Appreciate any pointers.

> 

> 

> This is a snippet of the code.

> 

>  Set CAT = New ADOX.Catalog

>   CAT.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _

>              "Data Source=" & path & "\fw.mdb;" & _

>              "Jet OLEDB:Database Password=;" & _

>              "Jet OLEDB:Engine Type=5;"

> Dim TBL As ADOX.Table

>   Set TBL = New ADOX.Table

>   TBL.Name = "access"

>   Set TBL.ParentCatalog = CAT

>   TBL.Columns.Append "user_id", adVarWChar, 10

>   TBL.Columns("user_id").Attributes = adColNullable

> '  ** This failed tbl.Columns.Properties("Set OLEDB:Allow Zero Length")=1

> '  ** This failed too  TBL.Columns("user_id").Properties("Jet 

OLEDB:Allow 

> Zero Length") = 1

> 

> 

>   CAT.Tables.Append TBL

>   Set TBL = Nothing

> 

> Regards

> Graham

> 


  Return to Index