jack niekerk
asked on
PREVENTING BREAKOFF STRINGS WITH CHR(0) IN RECORDS-SETS
I have a ADO.recordset open on een database (pervasive)
I read record to this set.
one field is fixed to 8 bytes
we use this to put in MKD-style
if the string does not contain any chr$(0) value all is ok,
but the moment it contains 1 or more chr$(0) the string during
update or reading will be cut off at postion chr$(0)
Using random file with fielded string 8 bytes goes ok
I read record to this set.
one field is fixed to 8 bytes
we use this to put in MKD-style
if the string does not contain any chr$(0) value all is ok,
but the moment it contains 1 or more chr$(0) the string during
update or reading will be cut off at postion chr$(0)
Using random file with fielded string 8 bytes goes ok
You must use a binary field
ASKER
Do you mean that in my recordset DNS resources i must define the field not as char?
I'am not sure if a understand you, sorry .
Jack
I'am not sure if a understand you, sorry .
Jack
I don't know your database details but if you want to store a chr$(0) in a database you must do it in a binary field. The NULL character has a special meaning in some systems. It is used to signal end-of-string, so, don't store it in a string field but in a binary field.
ASKER
Ok, the VBdatabase is pervasive, the Dosdatabase is Btrieve , or just
plain 'old' likewise Field #1, 8 as Money$, 30 as text$
then: LSET Money$ = MKD$(amount#) :
I can read these files in VB ok, and convert back as Money#=CVD(rs.name)
but msoft MKD double prec. will contain sometimes in the 8 byte a '0' byte
If i do reading in VB with old-plain fielding all ok,
as soon as it is redirected to ADO.recordset, at chr(0) point in a string it
will break off. so sometimes 7 bytes, then 5 bytes or if at leading pos. zero bytes
returned. in all other case CVD(rsrecord) is ok
plain 'old' likewise Field #1, 8 as Money$, 30 as text$
then: LSET Money$ = MKD$(amount#) :
I can read these files in VB ok, and convert back as Money#=CVD(rs.name)
but msoft MKD double prec. will contain sometimes in the 8 byte a '0' byte
If i do reading in VB with old-plain fielding all ok,
as soon as it is redirected to ADO.recordset, at chr(0) point in a string it
will break off. so sometimes 7 bytes, then 5 bytes or if at leading pos. zero bytes
returned. in all other case CVD(rsrecord) is ok
I am not sure if you are refering actually to CHR$(0), the null character, or CHR$(48), the zero digit character.
If the first, maybe you can replace the CHR$(0) with a space or a zero character.
If the first, maybe you can replace the CHR$(0) with a space or a zero character.
ASKER
chr$(zero), you can't replace, i did a test run on a loop from -99999999 to +999999999
the full asci set is used in combination with all these amounts
the full asci set is used in combination with all these amounts
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
when i use the commands
cn.MoveNext
dummy$= cn.Fields(21) ' (fields(21) contains a binary value 8 bytes
the string will contain chr(0) postitions, but is not terminated and has 8 bytes
the I can use the CVD(dummy$) function to get the money value , double preciscion
Only when I retrieve a record form ADOset is terminated.
cn.MoveNext
dummy$= cn.Fields(21) ' (fields(21) contains a binary value 8 bytes
the string will contain chr(0) postitions, but is not terminated and has 8 bytes
the I can use the CVD(dummy$) function to get the money value , double preciscion
Only when I retrieve a record form ADOset is terminated.
ASKER
it is solved in a mayby dum way,
I do this but not really smart I think suggested solutions sofar in this question block
did not work
Private Sub brokergrid_RowColChange(La stRow As Variant, ByVal LastCol As Integer)
brNum = brokergrid.Text
If rsBrokers.BOF = False And rsBrokers.EOF = False Then
If brokergrid.Text > LastKey Then
While rsBrokers.Fields(0) < brokergrid.Text
If rsBrokers.EOF Then Exit Sub
rsBrokers.MoveNext
Wend
Else
If rsBrokers.BOF Then Exit Sub
While rsBrokers.Fields(0) > brokergrid.Text
rsBrokers.MovePrevious
Wend
End If
sftBeginSaldo.Text = STR(CVD(rsBrokers.Fields(2 1)))
End If
I do this but not really smart I think suggested solutions sofar in this question block
did not work
Private Sub brokergrid_RowColChange(La
brNum = brokergrid.Text
If rsBrokers.BOF = False And rsBrokers.EOF = False Then
If brokergrid.Text > LastKey Then
While rsBrokers.Fields(0) < brokergrid.Text
If rsBrokers.EOF Then Exit Sub
rsBrokers.MoveNext
Wend
Else
If rsBrokers.BOF Then Exit Sub
While rsBrokers.Fields(0) > brokergrid.Text
rsBrokers.MovePrevious
Wend
End If
sftBeginSaldo.Text = STR(CVD(rsBrokers.Fields(2
End If