String handling difference between ODBC and OLEDB
- From: MarcoV <nieuwsgroep@xxxxxxxx>
- Date: Fri, 14 Aug 2009 07:17:20 -0700 (PDT)
Hi all,
I have a weird problem, I will try to explain below:
We are working with Clarion 6 and connect to a Pervasive database. One
of the tables in the database is a 'general' table, containing all
preferences. It has 2 columns, a number defining the preference page
and a string(500) containing the different preferences.
Each preference page has different variables that are defined with the
right type, e.g. a checkbox on a page is defined as a byte, etc. This
page definition is then laid over the string(500) to read and store in
the database. All well so far...
Now we have also an external .NET application that needs to read data
from this table (using DDF files), and it connects either using an
ODBC driver, or an OLEDB driver.
Now comes the thing I do not understand: When using the ODBC driver I
can easily read records from the preference table. As an example: I
have some checkboxes that are stored on position 34 to 44 in the
string. Using ODBC I can read the values from those positions without
any problem, but when using OLEDB I always get 0 (zero) back...
The code in .NET I use is the following:
DbDataReader rdr = lConnection.ExecuteCommand("SELECT p_string FROM
PrefTable WHERE Nr_Page=1");
if (rdr.HasRows() )
{
rdr.Read();
char[] options = new char[10];
rdr.GetChars(0, 34, options, 10);
}
lConnection can be a ODBC connection or a OLEDB connection. When using
ODBC the char array contains the right values, but when using OLEDB
the char array contains the wrong values....
I also made a test that reads all characters from the preference
string. In ODBC now I see the second characters is a '\0', that might
have the meaning of end-of-string. Mayb OLEDB does not handle this
correctly? When reading only the first character, it is the same using
ODBC and OLEDB.
Thanks for any help on this (maybe this is not the correct newsgroup,
if not can anyone point me to the right one?
.
- Follow-Ups:
- Re: String handling difference between ODBC and OLEDB
- From: Earl R Coker
- Re: String handling difference between ODBC and OLEDB
- Prev by Date: GPF when using START and POST
- Next by Date: Re: String handling difference between ODBC and OLEDB
- Previous by thread: GPF when using START and POST
- Next by thread: Re: String handling difference between ODBC and OLEDB
- Index(es):
Loading