Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Ado Big Problem

Posted on 2004-10-14
3
Medium Priority
?
291 Views
Last Modified: 2013-12-03
Hello experts....

I have a problem.

The project is in C++ (#import "msado15.dll... etc)

Everything works rather well...
The connection to an Access database works fine.

I create a recordset by calling the Execute method of the connection object.
The command is valid ("select col1, colb from anytable where condition")
After that, I start to scan the recordset by
char *str = (char*)pRecordset->Fields->GetItem("Col1")->Value;
pRecordset->MoveNext ();

The problem is that in some minor cases, I get garbage in the variable str.

I tested reading twice the value and check if the method fails in some minor cases.
That was not the problem, no mather how many times i call.
str = (char*)pRecordset->Fields->GetItem("Col1")->Value;
I suspect that the DB Engine is returning that garbage. (in this case Access)

If some one can help me about this.... I will apretiate it.





0
Comment
Question by:Marsc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
WxW earned 1000 total points
ID: 12312116
AS far as I can remember, ADOFields :: get_Item creates the VARIANT itself, and it does not return a char* .

I used this code, it may help:

         for(int i = 0 ; i < RecordCount ; i++)
               {
            ADOField* aF = 0;
            VARIANT vt;
            vt.vt= VT_I4;
            vt.intVal = i;

               aFS->get_Item(vt,&aF);
            if (!aF)
                  continue;

               wchar_t* Name = 0;
            aF->get_Name(&Name);

               VARIANT Value = {0};
            aF->get_Value(&Value);

         // Now use these 'Name' and 'Value'

}....
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question