[Q] MFC ODBC recordsets, 'data truncated' ?
Sandor Spruit -- Sandor.Spruit@let.ruu.nl
Monday, July 01, 1996
[Environment: WinNT 3.51, MSVC++ 4.1, ODBC 2.5]
Hi all,
I use the following set of statements to retrieve information from a Sybase
database server (using ODBC recordsets)
.m_strFilter = ;
.Open();
while (!.IsEOF())
{
// some sophisticated piece of code here :)
.MoveNext()
}
.Close();
The call to Open() generates a warning from the ODBC driver, saying something
like "success with info, data truncated", with ODBC status 01004 (?). Could
anyone explain what happens here ? The program works fine and displays data
that looks OK to me, but what about this "truncated" stuff, then ? Am I
missing something obvious here ?
Enlighten me, please :)
TIA,
Sandor
===========================================================================
ir A.G.L. Spruit - Utrecht University - Vakgroep Computer & Letteren
There is a bit of magic in everything,and then some loss to even things out
(Lou Reed,"Magic and loss")
Thierry Jorand -- Thierry.Jorand@csee-com.fr
Monday, July 08, 1996
[Mini-digest: 3 responses]
>[Environment: WinNT 3.51, MSVC++ 4.1, ODBC 2.5]
>
>
>
> .m_strFilter = ;
> .Open();
> while (!.IsEOF())
> {
> // some sophisticated piece of code here :)
> .MoveNext()
> }
> .Close();
>
>The call to Open() generates a warning from the ODBC driver, saying something
>like "success with info, data truncated", with ODBC status 01004 (?). Could
>anyone explain what happens here ? The program works fine and displays data
>that looks OK to me, but what about this "truncated" stuff, then ? Am I
>missing something obvious here ?
>
The Open() function calls DoFieldExchange. DoFieldExchange calls some ODBC
functions like SQLFetch, or SQLExtendedFetch and SQLBindParameter. All this
functions may return SQL_SUCCESS_WITH_INFO S1004.
You should step DoFieldExchange to see wich field(parameter eventually...)
return this warning.
You should compare the data type in recordset and the data type in database.
A very common
hitch is a database field CHAR 500, for example wich is mapped to a CString.
But in DofieldExchange RFX_Text is called with a default length of 255.
Another idea is a database field NUMBER mapped to a recordset float when a
double is needed.
I hope this helps.
Thierry
+-----------------------------------+------------------------------------+
| CS-TELECOM Compagnie des Signaux | Thierry.Jorand@csee-com.fr |
+-----------------------------------+------------------------------------+
| PoBox 11, Rue de Cambrai | Site : Paris - Cambrai |
| 75945 PARIS Cedex 19 FRANCE | Name : Thierry Jorand |
| Phone : 33 (1) 44 89 45 00 | Software Project Manager |
| Fax : 33 (1) 44 89 45 45 | Phone : 33 (1) 44 89 49 42 |
+-----------------------------------+------------------------------------+
-----From: "Lior M. Messinger" <100274.2607@CompuServe.COM>
It might be something completely unrelated - try to check your stack - it should
be over 20K. I had exactly this same error and enlargibg the stack worked
wonderfully.
Lior Messinger.
-----From: "Stew: Rob Stewart"
I use the Sybase Open Client library for accessing Sybase Open Servers
(including SQL Servers). You can open connections configured to provide
extra diagnostic or state information not normally provided. Perhaps the
driver is producing or relaying a message that says some of this information
is not being captured as it ought.
Robert Stewart | My opinions are usually my own.
Datalytics, Inc. | stew@datalytics.com
| http://www.datalytics.com
Donald McSwain -- DMcSwain@timeline.com
Thursday, July 11, 1996
[Mini-digest: 2 responses]
If you are binding using RFX_Text and your column size is > 255 that you
supply the appropriate nMaxLength value. Your data may appear to be ok
because it happens to be <= 255.
-----From: Alexandre de Brito Nobre
I had this very same problem last month, and couldn't find its cause, but
I solved it by trial and error method. This is what I've done:
1. Call the recordset from ClassWizard (I'm using VC++ 1.5);
2. Delete variable bound to the field that is causing the problem (If you
don't know which one it is, delete them all);
3. Call Update Columns (or equivalent) command;
4. After chosing Data Source and Table, call Bind All command;
I know it's strange, mainly because the source code remain the same, but it
worked.
--
Alexandre de Brito Nobre
mailto:brito@tba.com.br
Fones : 55(061)346-67-08
55(061)346-07-67
Brasilia - DF - Brasil
| Вернуться в корень Архива
|