Author |
Topic |
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 20 August 2002 : 12:29:38
|
I've noticed this on my own forums, thought nothing of it, tried it again, got the same result and figured I'd done something wrong. What happens is that after running setup, using an Access 2000 database, several fields in the table FORUM_MEMBERS are set to not allow zero length entries. This gives problems when someone registers.
I said something about it in another topic but got told that it wasn't a bug as it hadn't been reported yet. Only a few minutes ago TestMagic posted with this same problem, making me wonder if there's something wrong with the setup file or not.
Also, this might be a different bug though, and I'm not 100% sure of it: shouldn't the country field be set to allow 60 characters instead of 50? |
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 20 August 2002 : 13:06:12
|
I thought the database was suppose to be set to No for zero length strings? at least thats was ruirib said here he also gave a fix here I think
|
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 20 August 2002 : 13:55:12
|
I was aware of that fix but as it didn't say what it fixed I didn't take notice of it. Still, setting them to allow zero length fixes the problem too so the advise I gave earlier wasn't bad IMO.
As for the second bug I posted about... Am I correct that the field length should be increased? |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 20 August 2002 : 19:39:49
|
The actual state of an existing Database is going to be different for certain people. If you open an Access DB in Microsoft Access, field properties can be changed. If you compact a Database, field properties can be changed.
Just change the attribute of the field so that it allows zero length fields, if you are getting are getting an error. |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 20 August 2002 : 23:25:01
|
quote: Originally posted by RichardKinser
The actual state of an existing Database is going to be different for certain people.
Agreed.
quote:
If you open an Access DB in Microsoft Access, field properties can be changed.
Not unless you change them, AFAIK. Never seen that happen with my Access apps.
quote:
If you compact a Database, field properties can be changed.
They shouldn't change. After all the way you define your properties may be of fundamental importance for your database application. Also never noticed any changes.
|
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
alex042
Average Member
USA
631 Posts |
Posted - 28 August 2002 : 23:48:09
|
Interesting, I was just pondering this earlier today. I was wondering why I couldn't get my dbs script to allow zero length.
|
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 29 August 2002 : 02:47:29
|
That is a DAO script, not ADO.
afaik, anytime you create a new textual column in Access it will default to "allow zero-length" = no, so any DBS files, any db modifications through scripts, etc will reset the zero length property.
I'm going to look around, it seems to me I ran across a script that would let you change that property from an asp page.
|
====== Doug G ====== Computer history and help at www.dougscode.com |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 29 August 2002 : 02:53:55
|
Richard, here's a sample snippet that may work.
set con = server.createobject("ADODB.Connection") set cat = server.CreateObject("ADOX.Catalog") con.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\temp\northwind.mdb;" set cat.ActiveConnection = con set tbl = cat.Tables("Employees") tbl.Columns("LastName").Properties("Jet OLEDB:Allow Zero Length") = true set tbl = nothing set cat = nothing set cnn = nothing
I don't know much about ADOX but I think it's installed as part of MDAC. I think I tested this out a long time back and when edited to real values it worked.
|
====== Doug G ====== Computer history and help at www.dougscode.com |
Edited by - Doug G on 29 August 2002 02:55:55 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 29 August 2002 : 06:25:23
|
You're right Doug, ADOX is part of the MDAC. I think you need you to use a JET OLEDB driver to be able to use ADOX, though.
<edit>Actually, it is also supported with the JET OLEDB provider for OBDC, though some features are not available. And there is this info on MSDN, regarding access to the Table collection, that makes suspect that your code may not work with the ODBC driver:
The Append and Delete methods are not supported. Properties are read/write prior to object creation, and read-only when referencing an existing object. </edit> |
Snitz 3.4 Readme | Like the support? Support Snitz too |
Edited by - ruirib on 29 August 2002 07:07:24 |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 29 August 2002 : 09:23:46
|
The following will set the "Allow Zero Length" attribute to "True" for all MEMO and TEXT fields in an Access DB:
<% set con = server.createobject("ADODB.Connection") set cat = server.CreateObject("ADOX.Catalog") con.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\inetpub\wwwroot\v3401\snitz_forums_2000.mdb;" set cat.ActiveConnection = con Dim objTable, objColumn for each objTable in cat.Tables if objTable.Type = "TABLE" then Response.Write objTable.Name & "<br>" for each objColumn in objTable.Columns if objColumn.Type = 202 or objColumn.Type = 203 then objColumn.Properties("Jet OLEDB:Allow Zero Length") = true Response.Write " " & objColumn.Name & "(" & objColumn.Type & ") AllowZeroLength set to True<br>" end if next Response.Write "<p>" end if next set cat = nothing set cnn = nothing %>
Found the following that will display all tables/columns in an Access Database with some information about each field:
http://www.4guysfromrolla.com/webtech/101799-1.shtml |
|
|
alex042
Average Member
USA
631 Posts |
Posted - 29 August 2002 : 09:27:15
|
quote: set con = server.createobject("ADODB.Connection") set cat = server.CreateObject("ADOX.Catalog") con.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\temp\northwind.mdb;" set cat.ActiveConnection = con set tbl = cat.Tables("Employees") tbl.Columns("LastName").Properties("Jet OLEDB:Allow Zero Length") = true set tbl = nothing set cat = nothing set cnn = nothing
This worked, but it returned a 'document contained no data' error after it set the variables and a delay. Any ideas on how to eliminate this error and the delay?
|
|
|
alex042
Average Member
USA
631 Posts |
Posted - 29 August 2002 : 10:23:12
|
quote: The following will set the "Allow Zero Length" attribute to "True" for all MEMO and TEXT fields in an Access DB:
That worked better. It set all the allow zero values to true and I didn't get the previous error. I assume by combining the two, I can specify which tables I want to change if I don't want to change the entire database.
This might be a good function to use in the setup for the next version.
|
|
|
coolguyz
Starting Member
11 Posts |
Posted - 30 September 2002 : 13:29:40
|
quote: Originally posted by RichardKinser
The following will set the "Allow Zero Length" attribute to "True" for all MEMO and TEXT fields in an Access DB:
<%
set con = server.createobject("ADODB.Connection")
set cat = server.CreateObject("ADOX.Catalog")
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\inetpub\wwwroot\v3401\snitz_forums_2000.mdb;"
set cat.ActiveConnection = con
Dim objTable, objColumn
for each objTable in cat.Tables
if objTable.Type = "TABLE" then
Response.Write objTable.Name & "<br>"
for each objColumn in objTable.Columns
if objColumn.Type = 202 or objColumn.Type = 203 then
objColumn.Properties("Jet OLEDB:Allow Zero Length") = true
Response.Write " " & objColumn.Name & "(" & objColumn.Type & ") AllowZeroLength set to True<br>"
end if
next
Response.Write "<p>"
end if
next
set cat = nothing
set cnn = nothing
%>
Found the following that will display all tables/columns in an Access Database with some information about each field:
http://www.4guysfromrolla.com/webtech/101799-1.shtml
Could you tell me where to put the code to make it work? On what page?
Thank you |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 30 September 2002 : 15:41:52
|
You can put this code in a new page, name it iDontKnowWhatToNameThisPage.asp
Edit the connection string to match where you database lives.
Make a backup copy of your database file first.
Then open the new page in your browser and your problems should be cured.
|
====== Doug G ====== Computer history and help at www.dougscode.com |
|
|
Topic |
|