Home > Archive > MS SQL Server ODBC > January 2006 > SQL_NEED_DATA During ODBC Query









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL_NEED_DATA During ODBC Query
Reuven Nisser

2006-01-09, 7:23 am

Hello,
I am using MFC 6.0 CRecordset to access data inside an SQL Server table
TEMPORARY_DATA. The table contains also a BLOB field.

The query I am using is:
SELECT * FROM TEMPORARY_DATA WHERE
TD_DESTINATION_ID='0
5101' AND TD_PLAN_DATE < {ts '2006-01-09 00:00:00'}
AND TD_PLAN_DATE >= {ts '2006-01-07 00:00:00'} AND TD_PLAN_DATE_END >
{ts '2006-01-08 00:00:00'} AND TD_STATUS<>'P' AND TD_STATUS<>'X' AND (ID
like '75%'))

I receive SQL_NEED_DATA error. I do not know exactly where it happens.
Maybe during Open() or MoveNext().

When using standard CRecordset programming with variables loaded
automatically from the record to program variables, how should I handle
such a problem?

Thank you,
Reuven Nisser
Steven Cheng[MSFT]

2006-01-10, 3:23 am

Hi Reuven,

Welcome to MSDN newsgroup.
From your description, you're encountering some problem when using ODBC API
to connect and query a sqlserver database, for such problem, I think we can
first try the sql statement in QA to ensure that it works....

Then, at program side, I suggest you try creating a simplified program to
query the data table. If you still encounter the problem, there may have
something incorrect with the code or the connection between server. Also,
if convenient, would you provide some further detailed code sinppet on
this...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| Message-ID: <43C24382.9050505@newsgroup.nospam>
| Date: Mon, 09 Jan 2006 13:05:38 +0200
| From: Reuven Nisser <rnisser@newsgroup.nospam>
| User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| CC: Yehuda Unger <yu@practiq.net>
| Subject: SQL_NEED_DATA During ODBC Query
| Content-Type: text/plain; charset=ISO-8859-8-I; format=flowed
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.public.sqlserver.odbc
| NNTP-Posting-Host: dsl217-132-219-253.bb.netvision.net.il 217.132.219.253
| Lines: 1
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.odbc:44612
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Hello,
| I am using MFC 6.0 CRecordset to access data inside an SQL Server table
| TEMPORARY_DATA. The table contains also a BLOB field.
|
| The query I am using is:
| SELECT * FROM TEMPORARY_DATA WHERE
| TD_DESTINATION_ID='0
5101' AND TD_PLAN_DATE < {ts '2006-01-09 00:00:00'}
| AND TD_PLAN_DATE >= {ts '2006-01-07 00:00:00'} AND TD_PLAN_DATE_END >
| {ts '2006-01-08 00:00:00'} AND TD_STATUS<>'P' AND TD_STATUS<>'X' AND (ID
| like '75%'))
|
| I receive SQL_NEED_DATA error. I do not know exactly where it happens.
| Maybe during Open() or MoveNext().
|
| When using standard CRecordset programming with variables loaded
| automatically from the record to program variables, how should I handle
| such a problem?
|
| Thank you,
| Reuven Nisser
|

Reuven Nisser

2006-01-10, 8:23 pm

Hi Steven,

1. Yes, the first thing I've done is to try it with QA and it worked.
2. In CDBException m_strStateNativeOrig
in is empty.
3. The error returned is 100 (SQL_NEED_DATA).
I think all of the above indicate that we are talking about ODBC/MFC
level problem and not SQL Server problem.

The problem appears only when using large scale database at the client
production site. To continue testing the problem I need to know more
about this SQL_NEED_DATA.

I read several ODBC articles about the problem. What I understood from
the article is that it's not an error and it indicates something more to
be done to retrieve the data. Now I am trying to combine them with my
MFC usage:
To access the database I am using CDatabase class with ODBC DSN, simple
Open(). Now I create a record structure using CRecordset class with all
the field list described in DoFieldExchange(). I am setting m_strFilter
and trying to Open() the table.

All is very simple, no special SQL queries. The only special issue is
the usage of a BLOB field which is defined as CLongBin class.

So, to my opinion, the problem should be solved internally by MFC 6.0,
but instead I am getting it. What am I missing? What should I do when I
get this error?

Thanks, Reuven
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com