Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 3.4 Fields set to not allow zero length value
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 20 August 2002 :  12:29:38  Show Profile
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  Show Profile
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 20 August 2002 :  13:55:12  Show Profile
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?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 August 2002 :  18:57:07  Show Profile  Send ruirib a Yahoo! Message
Roland, have you compared Snitz 3.3.0x and Snitz 3.4 Db's as to the zero length issue?


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 20 August 2002 :  19:39:49  Show Profile
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.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 20 August 2002 :  23:25:01  Show Profile  Send ruirib a Yahoo! Message
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 28 August 2002 :  22:23:48  Show Profile
While looking for a way to set the "Allow Zero Length" field via a script, I came across this:

http://support.microsoft.com/default.aspx?scid=kb;en-us;q130336

If only there was a way to do this via vbscript...
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 28 August 2002 :  23:48:09  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
Interesting, I was just pondering this earlier today. I was wondering why I couldn't get my dbs script to allow zero length.
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 August 2002 :  02:47:29  Show Profile
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
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 August 2002 :  02:53:55  Show Profile
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
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 August 2002 :  06:25:23  Show Profile  Send ruirib a Yahoo! Message
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 29 August 2002 :  09:23:46  Show Profile
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
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 29 August 2002 :  09:27:15  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
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?
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 29 August 2002 :  10:23:12  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
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.
Go to Top of Page

coolguyz
Starting Member

11 Posts

Posted - 30 September 2002 :  13:29:40  Show Profile
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
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 30 September 2002 :  15:41:52  Show Profile
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
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07