473,903 Members | 3,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DAO Garbage at 256+ Characters

Hi ! can any of you help ?

Since datasheets and forms can happily display calculated fields over 255 characters long,
I was surprised to discover that the same when read via a DAO recordset beyond 255
characters is replaced with garbage.
I'd be interested in how many of you also experience this problem. To see if you have, try
one of the follow examples.

Example
----------
To display the last 60 of 300 'x's, press Ctrl-G and enter the following:

(*** TYPE AS ONE LINE ***)
?Mid(dbengine(0 )(0).OpenRecord set("Select String(300,'x') From
MSysObjects").G etRows(1)(0,0), 241)

If the above produced some 'x's followed by garbage, rather than entirely 'x's, then you
have the problem too.
The following clearly shows that the field calculations are actually carried out
correctly:

(*** TYPE AS ONE LINE ***)
?dbengine(0)(0) .OpenRecordset( "Select String(300,'x') As Str,Mid(Str,200 ) From
MSysObjects").G etRows(1)(1,0)

Details
--------
When an SQL calculated field exceeds 255 characters, the result is a Variable-Size Text
Field, Size 0.
The field displays fine in text boxes, datasheets and when using DLookup, but produces
garbage after the 255th character only when read programmaticall y with recordsets. This
garbage differs with whether you interrogate it as Recordset!Field or
Recordset!Field .Value, or RecordSet("Fiel d") versus RecordSet!Field , or when you specify
such things as dbForwardOnly or not, etc.
Anything calculative seems to do this - functions returning over 255 characters, or just
simple equations like MemoFieldOver25 5Chr & 'xxx'. The calculations are performed
correctly internally, as the second example below shows.
Placing the SQL as the RecordSource of a form and using a TextBox to display the offending
field results in correct data, and then doing a Form.RecordSetC lone and reading the source
data of that TextBox yields the usual garbage !!
If you Select Into a new Table you get truncation of the data to 255 chr
If you Insert Into an existing Table with the offending field a Memo, it is correctly
written
GetChunk etc fails as it thinks it is a Variable Size Text Field, Size 0
Reading through the garbage in a non-unicode loop from bytes 512 To 599 suggests no
particular rhyme or reason, as there are only a few fragmentary repeating numbers after
character 255 for a string that should be entirely repeating characters.
The *practical* problem arises particularly with generic functions carrying out actions
using recordsets (or Sql) passed as parameters, the only workaround I can see is to create
a temporary table with Memos, perform an Insert Into and read the data off, then delete
the table.

Environment
---------------
This occurs for me on Access 97, 2000 and 2002, latest service packs on both Jet and
Access.
I have XP Home edition but I asked someone on an entirely different OS, different
Access 97 and DAO service packs, and the results were the same.

I'd very much hope to hear what you folk find, and any solutions...

David



Nov 12 '05 #1
3 6958
Well, I can tell you for sure that the methods that work do not attempt to
use the DAO GetRows() method. Do you specifically need it for anything in
particular?
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"David Merrick" <de********@mem bers.v21.co.uk> wrote in message
news:3f******@n ews.greennet.ne t...
Hi ! can any of you help ?

Since datasheets and forms can happily display calculated fields over 255 characters long, I was surprised to discover that the same when read via a DAO recordset beyond 255 characters is replaced with garbage.
I'd be interested in how many of you also experience this problem. To see if you have, try one of the follow examples.

Example
----------
To display the last 60 of 300 'x's, press Ctrl-G and enter the following:

(*** TYPE AS ONE LINE ***)
?Mid(dbengine(0 )(0).OpenRecord set("Select String(300,'x') From
MSysObjects").G etRows(1)(0,0), 241)

If the above produced some 'x's followed by garbage, rather than entirely 'x's, then you have the problem too.
The following clearly shows that the field calculations are actually carried out correctly:

(*** TYPE AS ONE LINE ***)
?dbengine(0)(0) .OpenRecordset( "Select String(300,'x') As Str,Mid(Str,200 ) From MSysObjects").G etRows(1)(1,0)

Details
--------
When an SQL calculated field exceeds 255 characters, the result is a Variable-Size Text Field, Size 0.
The field displays fine in text boxes, datasheets and when using DLookup, but produces garbage after the 255th character only when read programmaticall y with recordsets. This garbage differs with whether you interrogate it as Recordset!Field or
Recordset!Field .Value, or RecordSet("Fiel d") versus RecordSet!Field , or when you specify such things as dbForwardOnly or not, etc.
Anything calculative seems to do this - functions returning over 255 characters, or just simple equations like MemoFieldOver25 5Chr & 'xxx'. The calculations are performed correctly internally, as the second example below shows.
Placing the SQL as the RecordSource of a form and using a TextBox to display the offending field results in correct data, and then doing a Form.RecordSetC lone and reading the source data of that TextBox yields the usual garbage !!
If you Select Into a new Table you get truncation of the data to 255 chr
If you Insert Into an existing Table with the offending field a Memo, it is correctly written
GetChunk etc fails as it thinks it is a Variable Size Text Field, Size 0
Reading through the garbage in a non-unicode loop from bytes 512 To 599 suggests no particular rhyme or reason, as there are only a few fragmentary repeating numbers after character 255 for a string that should be entirely repeating characters.
The *practical* problem arises particularly with generic functions carrying out actions using recordsets (or Sql) passed as parameters, the only workaround I can see is to create a temporary table with Memos, perform an Insert Into and read the data off, then delete the table.

Environment
---------------
This occurs for me on Access 97, 2000 and 2002, latest service packs on both Jet and Access.
I have XP Home edition but I asked someone on an entirely different OS, different Access 97 and DAO service packs, and the results were the same.

I'd very much hope to hear what you folk find, and any solutions...

David




Nov 12 '05 #2
de********@memb ers.v21.co.uk (David Merrick) wrote in
<3f******@news. greennet.net>:
This occurs for me on Access 97, 2000 and 2002, latest service
packs on both Jet and Access.
I have XP Home edition but I asked someone on an entirely
different OS, different Access 97 and DAO service packs, and the
results were the same.

I'd very much hope to hear what you folk find, and any
solutions...


I don't use GetRows, but I've encountered exactly what you're
encountering in many situations where I was concatenating memo
fields (for the printing of a catalog in Word, which needed to
concatenate multiple comment fields).

The only solution I came up with was to leave the concatenation to
the very end. If you look at the source for this (all on one line):

http://wurlitzerbruck.com/Search/ind...ss=search&List[]=Aut
ograph+Letters% 2C+signed&show_ body=1

You'll see multiple spaces in some of the comments. This is because
three comment fields are being concatenated in the PHP code. Since
HTML handles redundant spaces properly, it works OK (i.e., in HTML
2 spaces or 3 or 10 are rendered as 1), so this works out OK.

In non-HTML contexts, it's more complex.

Displaying the same data in a Word merge file, I have to test the
individual fields to figure out where to put a space, and the
conditionals get pretty messy looking.

I posted about this problem along time ago and got no real answers
on it -- it seems that few people have encountered this problem.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #3

Hello ! thanks for the two postings.

The .GetRows() was purely to make the example simple to paste in.

You'll see from the message the other ways the problem arises : in
general, every way of reading the data through DAO exhibits the problem
of fields over 255 characters long being garbaged, of which reading
Recordset!Field values will be the most common structure affected.

I've subsequently tried it on more environments, and it does seem to
affect all versions of DAO (try referencing different versions), Access,
and Windows.

I was unable to tell exactly from the source html of your link what you
were really meaning as a workaround for generic functions. With specific
functions, you can read the raw field data yourself and code the desired
equations in your language code outside the Sql. However, if Sql is
passed to a generic user-defined function, the function doesn't want to
have to be told how to concatenate fields together itself explicity in
code, it should all be done in the Sql or Recordset that is passed in.
Also, since many calculated fields do not involve simple concatenation
(e.g. it might involve using the result of a user-defined- or build-in-
function which returns a string more than 255 characters, as in the
example), this makes it impossible to write generic functions handling
Recordsets through the simple workaround of passing in a parameter which
tells the generic function which fields to aggregate together. The only
two workarounds I can see is that the function should detect a certain
field name suffix which indicates to Eval that field value (having first
replaced values inside it with the other fields) e.g. Select
'MyFunc({Age},{ Name})' As FnEval, ... would cause it to be replaced with
values read from other fields e.g. MyFunc(23,'Mich ael') and then be Eval()-
ed, e.g. 'Michael is 23'.

The second method is to create a temporary table and do an Insert Into
and then open that temporary table. This would work for Sql passed in,
but not Recordsets.

Thanks,

david
--
Posted via http://dbforums.com
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
23374
by: Jay Chan | last post by:
I am trying to use a command line program to run a stored procedure that generates output in a comma-delimitted format. Somehow, ISQL or OSQL always wrap the lines at 256 characters. I believe this has something to do with the column width switch (-w). But enlarging the column width to 800 characters max still doesn't help. The following is a stored procedure that is essentially doing what my stored procedure is doing: create procedure...
28
3408
by: joe | last post by:
I have a simple .NET application with two or three listViews which are filled with icons and when the user click on the proper item, they display the related images. I use "image = null ; " for all images that have been used and are going to be closed. This is how ever no way to reduce the memory consumption. I have noticed , using the task manager, that garbage collector doesn't actually do any collections unless the computer becomes low...
0
1336
by: JV | last post by:
Fellow members, I have read tons of content on the issue that ASP can not read Excel spreadsheet columns having more than 256 characters. I think I've read them all ... Here's what I do: strExcelDocName = "c:\test.xls" With cnnExcel .Provider = "Microsoft.Jet.OLEDB.4.0"
4
2972
by: lkrubner | last post by:
Pierre Goiffon Oct 6 2004, 4:29 am show options Newsgroups: comp.infosystems.www.authoring.html >> The problem with charset UTF-8 on pages with forms for e.g. >> guestbooks, formmail and bloggs is that writing in a non-english >> language can give garbage characters from the letters that is not> >> represented in the english language. That's because what is writed in >> the text box don't get encoded, as text done with HTML editors...
12
3191
by: Yandos | last post by:
Hello all, why is the file 257 bytes long in windows xp, when it contains only 256 characters?: #include <stdio.h> int main(void) { int i; FILE *out; if ((out = fopen("256.tmp", "w")) == NULL) {
1
1690
by: IC | last post by:
Hello, When debugging a SQL sproc in VS.NET, is there a way to get the debugger to retrieve the full value of a SQL variable if its content is longer than 256 characters? I currently have a SQL variable of type TEXT, its content is roughly 1000 characters. When stepping through the sproc in the debugger only 256 character are displayed in the watch windows and same thing with the Immediate Command Window.
2
2057
by: Amrit Kohli | last post by:
Hello. I have the following code, to do a simple operation by copying the elements of a vector of strings into an array of char pointers. However, when I run this code, the first element in the char array strarr holds garbage characters. For some reason, every time the strcpy function is called to copy the string in temp to the array, it fills the 0th element in the strarr array with garbage characters. Can someone try to compile this...
5
2290
by: Daniel Rudy | last post by:
Hello Group, I've looked at this backwards and forwards and I can't seem to find the problem here. What happens is I have a multidimensional array of char that has 3 dimensions with a declaration assignment. After a certian point in the array, I get garbage. Not sure why. Granted this is a little off topic because of what the code does, but I'm hoping that a few extra pairs of eyes can see what I'm missing. #define CRYPTO_KEYMAX ...
10
1972
by: Lawrence Krubner | last post by:
Once upon a time, there were no garbage characters on this page: http://www.teamlalala.com/blog/category/css/ Now there are. For instance: The 2nd paragraph from page 114 of “The Zen Of CSS Design” For me, there are garbage characters before "The" and after "Design".
0
9999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9847
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10500
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9684
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8048
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.