why GetFieldValue() is so slow

I get connected a vfp6 dbf file, and the total record number is about
50000, I want to export specified field value ( most of their type are
string), and the result is correct, but it works toooooo slow, and I
find the function GetFieldValue takes most time.
my code is:

		for(index=0; index < m_ListDest.GetCount(); index++)
			m_Rs.GetFieldValue(m_pSortList[index], strVal);
			strVal.TrimRight(_T(' '));

			if(strVal == "" && m_isFilter)

			strLine.Insert(0, _T('['));
			strLine.Insert(strLine.GetLength(), _T("]:"));
			strLine.Insert(strLine.GetLength(), strVal);
			strLine.Insert(strLine.GetLength(), C_Enter);
			strLine.TrimRight(_T(' '));
			fwrite(strLine.GetBuffer(2), sizeof(TCHAR), strLine.GetLength(),
		fwrite(&C_Enter, sizeof(TCHAR), 1, pOutput_file);

	if(RecordCount == 100)
			Time = GetTickCount() - Time;



the Time shows how long will it take, and because it is very slow, I
break it when 100 records have processed.

with the profile mode, it is obvious:

Profile: Function timing, sorted by time
Date:    Wed May 17 22:45:38 2006

Program Statistics
    Command line at 2006 May 17 22:45:
    Total time: 23453.762 millisecond
    Time outside of functions: 87.659 millisecond
    Call depth: 22
    Total functions: 227
    Total hits: 21321
    Function coverage: 61.2%
    Overhead Calculated 5
    Overhead Average 5

Module Statistics for databasetool.exe
    Time in module: 23366.103 millisecond
    Percent of time in module: 100.0%
    Functions in module: 227
    Hits in module: 21321
    Module function coverage: 61.2%

        Func          Func+Child           Hit
        Time   %         Time      %      Count  Function
   12373.771  53.0    12373.981  53.0      500
CRecordset::GetFieldValue(short,class CString &) (mfcd42d.dll)
    7784.674  33.3    23198.355  99.3      260
CWinThread::PumpMessage(void) (mfc42d.dll)
    2663.737  11.4     2668.303  11.4        1
CFileDialog::DoModal(void) (mfc42d.dll)
     156.984   0.7      158.311   0.7      102
CRecordset::Move(long,unsigned short) (mfcd42d.dll)
     114.126   0.5      114.354   0.5      807
CWnd::DefWindowProcA(unsigned int,unsigned int,long) (mfc42d.dll)
      86.992   0.4    23315.177  99.8        1 CDialog::DoModal(void)
      47.422   0.2    15134.158  64.8        1
CDatabasetoolDlg::Export2File(void) (databasetooldlg.obj)
      37.226   0.2       37.226   0.2        1
CDatabase::~CDatabase(void) (mfcd42d.dll)
      21.104   0.1    15328.205  65.6      927 CWnd::OnWndMsg(unsigned
int,unsigned int,long,long *) (mfc42d.dll)
      19.589   0.1       19.589   0.1     1000 CString::TrimRight(char)
      13.165   0.1       13.165   0.1        1
CRecordset::~CRecordset(void) (mfcd42d.dll)
       8.671   0.0        8.671   0.0      616 CListBox::GetCount(void)
       8.478   0.0      161.017   0.7        1
CDatabasetoolDlg::LoadDatabase(void) (databasetooldlg.obj)
       7.640   0.0    15308.511  65.5      260
CDialog::PreTranslateMessage(struct tagMSG *) (mfc42d.dll)
       3.455   0.0        3.455   0.0     1000
CString::Insert(int,char) (mfc42d.dll)
       3.217   0.0      152.538   0.7        1
CRecordset::Open(unsigned int,char const *,unsigned long) (mfcd42d.dll)
       1.890   0.0        2.012   0.0       21 CWnd::EnableWindow(int)

I want to know how can I make it faster, any advice is helpful, and
thank you!

5/17/2006 2:48:09 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 13


Similar Artilces:

Outlook 2003 Pro with XP Pro Too Slow with McAfee 2004
I just bought a new high-end brandname laptop with XP Pro. In it, I: - installed Office 2003 Pro, - installed McAfee Internet Security Center 6.0 2004 (including Firewall, AntiVirus, Privacy Service, Spamkiller), and - downloaded and installed all latest MS and McAfee software updates, by the books. Hoping to lessen intra-computer response, I opted out some sub-features in McAfee. The installations were easy. Without McAfee, Outlook 2003 was fast, reliable. After installing and working with McAfee, Outlook 2003 is miserably slow in most operations (send/receive, clicking on ema...

Exchange 2000 very slow
My Exchange 2000 SP4 is very slow and every computer keep showing the Outlook Send/Receive Progress window. This is happen every morning. I have to restart the Exchange Server twice a day, once in the morning and later in the afternoon. Once I do that then everything is ok until the afternoon around 3:30pm. Could someone please tell what could be causing this problem and how can I solve the problem? Thanks in advance, Look for any processes that start to eat more ram throughout the day. if you see one find out what app it is from and check the manufacturer for an update. Sounds li...

slow printing
Just installed new dell for boss with win2k and office 2k, all update including w2k sp4 and off2k sp3. User now states that his HP4000 laser prints slow compared to his win98 that this machine replaced. The slow printing only seem to occur in excell - other programs seem fine. Any suggestions would be much appreciated. Thanks Bob Page ...

Slow or no communication at all
Hello all. Since I'm new around here, please let me know if this is the right place to post this. I've been checking these forums for a long time now, but fortunately I always found what I was looking for and never had the need to post. For that, I want to thank you all for the tremendous work (and help) everyone participating here have been given throughout these years. The problem that brings me here today, relates not entirely to the SBS 2003. What happens is that we have several MAC OS machines connecting to several shares in a SBS 2003. Everything was ok untill one o...

Slow Viewing e-mails
Suddenly it's very slow to view e-mails in Outlook 2002. Any kind of e-mail, with or without attachments. It worked fine until a few days ago. Anyone have any ideas? Found an answer to the problem in another post. Simply turning of the Messenger Integration fixed everything. /Johan >-----Original Message----- >Suddenly it's very slow to view e-mails in Outlook 2002. >Any kind of e-mail, with or without attachments. It >worked fine until a few days ago. Anyone have any ideas? >. > On 25 nov 2003 Johan wrote: > Found an answer to the problem in another pos...

why GetFieldValue() is so slow
I get connected a vfp6 dbf file, and the total record number is about 50000, I want to export specified field value ( most of their type are string), and the result is correct, but it works toooooo slow, and I find the function GetFieldValue takes most time. my code is: while(!m_Rs.IsEOF()) { for(index=0; index < m_ListDest.GetCount(); index++) { strLine=m_pSortItem[m_pSortList[index]]; m_Rs.GetFieldValue(m_pSortList[index], strVal); strVal.TrimRight(_T(' ')); if(strVal == "" && m_isFilter) continue; strLine.Insert(0, _T('[')); ...

Money 2006 to 2008
I got the dreaded notice that I needed to update so that I could continue my services. Was running 2006. No problems. Upgraded to Money Plus 2008. I really am using just the basic features for now. It takes *forever* to open. Once I do an online update and it completes, it takes about twice or three times as long to return control to me as 2006 did. Any way to speed it up? I'm running Vista on a not too ancient dual core 2.2 GHz with 4 GB RAM. In microsoft.public.money, Grouch wrote: >I got the dreaded notice that I needed to update so that I could >continue my services....

Outlook runs slow
After downloading and installing an optional backup add-in from the microsoft website, i have noticed that outlook runs very slow now. Whenever i recieve new emails, there is a long delay when i select it to when the email actually appears. As well as when i delete it or adjust them in any way. This has caused me to delete wrong emails because i can't tell which one is selected because the delay in highlighting and bringing up the current email. Anyon have any idea why this is happening? Thanks for any help, Adam If you have Outlook 2002, try going to Tools -> Options -> Other...

why is synchronizing so slow in Outlook Live
I am using Outlook Live and find that the synchronizing of my folders is exceedingly slow. I can understand that at home (26.4 Kbps), but at work I'm on a 384 DSL connection. Further, it is not uncommon to simply get "stuck" at, say, 20 of 93 messages. Perhaps related, perhas not, is the fact that when I send and receive on my hotmail account, I get hung up at 99% done. ...

Slow Access 97 since moving to new 2003 Server
We have an access 97 MDB that we had on an NT4.0 server. We have about 30 wrksts that have mdb front ends loaded locally to access the MDB backend. All was great until this evening when we decided to ditch the 9 yr old NT 4 server and replace it with a Dell Dual Xeon 2003 R2 server. All data copied form the old server to the new server was perfect. Performance increases were everywhere when we talk about network thru put. However, once we try to get the workstations in to the database on the new server, performance leaves and QUICK !. To compare, the old server/workstation combo would ta...

Outlook slowed down seriously
My Outlook 2003 started slowing down seriously 2 days ago. It still works, but VERY slow. Not only during sending and receiving emails, just the whole program. E.g. when I click on the Outlook button on the task bar to get Outlook reappear, the Outlook frame and toolbars appear, but it takes ages for Outlook to show its content. Opening an email, and opening next email take ages (1 minute!) as well. The Task Manager shows only 3% of the CPU resources and a usual 50% of my 1MB memory are used, 50% HDD free, the HHD (or processor?) use indicator light not fully on, so it's not an overload of...

Slow Barcode Printing
Hi, I'm facing a problem at my client side that after installing and configuring MS SO v2, the labels of the items are printed very slow as compared to their previous system. Client has Monarch 9820 label printer and is used to very speedy barcode printing. In their existing system, they had a utilty that send what is need to be printing directly at machine level. However, perhaps SO takes labels as fonts etc. I need to speed up the barcode printing. Please help This is a multi-part message in MIME format. ------=_NextPart_000_0179_01C9079C.8FA249C0 Content-Type: text/plain; ch...

too Slow...!!!!
I have an excel sheet containing records not more than 1000 in A-T columns... I am using Fliter on this sheet and Also getting the same data on other sheet with vlookup formula... My file was working very nicely.. no problem in opening editing printing.all was quick now I have to wait approx 3 seconds just to move to next cell..!!!!!! its taking too much time in any action.... Plz help me.... Syed Obaid Since you said it worked OK once, try to press ctrl + end and see where it takes you, it should be the last cell with data. If it's way off from what you have select all rows below (...

Slow scrolling using cursor keys
On Windows XP Pro SP1a, running excel 2000. When using the cursor keys, scrolling is slow. i.e if you scroll to edge of screen and keep going, each column scrolls/updates quite slowly. However, it is fine when using the mouse. Is there a setting that needs to be changed? Cheers, Steve. This may be something you've already tried but have you set the key repeat/delay appropriately in the control panel? -- Regards, Bill Lunney www.billlunney.com "SteveC" <steven_p_curtis@hotmail.com> wrote in message news:eufzm9RUDHA.2460@TK2MSFTNGP10.phx.gbl... > On Windows XP Pro...

Slow Remote Access
Hi all, I've got a client with a central office with a SBS 2003 R2 box. This client also has a remote branch office with 2 users who RWW into their PC's located at the main office. Mostly, this is working fine, however, if they try to open a large PDF (5MB +) from a share on the SBS box, this sometimes takes over 10 minutes to open and occasionally causes the local PC to freeze. Is there any way to speed this up ? I am currently limited to 1 MB upload speed at each site at the moment. TIA. Regards Colin. Hi Colin, + Does the same pdf also open slowly when someon...

slow moving among records
Hello guys learning new things on access I keep improving my db, that is my family bank account. I’ll briefly explain how it is. In the main form there is a single record of my table, a sub form with 3 pages of graphs and several buttons to open forms of specific categories (car, children, house and so on). Everything works on queries based on the selected year. I had all this structure redundant for every year. To optimize and shrink the db, I changed all the queries in order to pass them the desired year from a list box. Now the annoying problem is that it takes a couple of seconds ...

Slow Login #2
I am having issues with a machine which does not host the Store Operations DB being slow to sign in. When the cashier signs in it thinks for about 10 seconds then lets you in to POS. They are on a 100mb network but suspect it is a comms issue backto thw SO. ...

GetFieldValue returns empty string on NVARCHAR(MAX) field.
Hello all, I have a problem with an MFC ODBC application using CRecordSet, retrieving a field of type NVARCHAR(MAX) into a multibyte CString variable (the code is not compiled for unicode because it is an old app which doesn't support that). GetFieldValue always returns an empty string, because it copies the data from the field into m_pszData[1] of the CString variable, instead of m_pszData[0] in the ::GetLongCharDataAndCleanup function. The only other mention of strange behaviour regarding SQL_WLONGVARCHAR or SQL_LONGVARCHAR I could find is in KB157071, but it looks like that has ...

Slow responce to functions
I'm using Office pro 2003. I just noticed that when I try to perform any simple functions in excel like cut and paste, copy and paste, even when I close a spreadsheet that I changed and when the option pops up to save, if I say no it takes way too long to perform these simple functions. Just a copy and paste of one cell I'll sit here and watch the hourglass for the better part 10 to 20 seconds. I went into word and it appears that it is doing the same thing. I have enough ram, 512 meg. I even tried closing everything, antivirus, spamware,etc to free up as much ram as possible bu...

vista slowing down...
Hi! I've been running Vista Home premium for a couple of years. Over the past months it has started to slow down, with warning about low memory (2 gig RAM). I defragment quite often. What else can I do? TIA Daniel -- --------------------------- Daniel Royer University of Geneva daniel at royer dot ch first you must do disk cleanup. you can do it by properties of local disk. and then you must defrag. disk. you must delete folders that you don't use, you must uninstall programs. do these things and than write here results. "Daniel Royer" <...

outlook 2003 slow loading
I have 2 email accounts one from roadrunner and 1 from MSN setup in outlook 2003 but when you click on the outlook program it takes up to 5 mins before it loads the program and I can access the email. Whay can I do to fix this ...

Email SLOW to show up on NT4 worstation
Server: SBS2000 with Exchange 2000, WINS & DNS pointing to the server, network - TCP/IP 10/100 Clients: XP Pro & NT4 with Outlook 2002 Up to date with service packs and patches Senario: An email is sent to users on the network. XP Pro user opens Outlook and the email pops up within a few seconnds in their Inbox. NT4.0 user opens Outlook and it takes close to 2 minutes before the email shows up in their Inbox. (Received time on the email is the same as the sent time). NT4 - PII 450MHz, 128MB XP - P4 1.7GHz, 256MB Is Outlook checking for received email as soon as it opens or is it on...

Slow Loading Word 2007
WIt seems to take quite a while to load word 7 as well it seems to shut down slowly or at times ir shows as word not responding. I've uninstalled MSoffice and then reinstalled and see no difference. Can anyone suggest something Thanks See http://word.mvps.org/FAQs/AppErrors/ProblemsStartingWord.htm. -- Stefan Blom Microsoft Word MVP "Norman" <Norman@discussions.microsoft.com> wrote in message news:39C173D8-965C-4B58-BCED-64EBCF18003F@microsoft.com... > WIt seems to take quite a while to load word 7 as well it seems to shut > down > slowly...

Sumproduct Slow
I have 13 columns of data with 30000 rows. Most data is numeric some is 2 words at the most. The computer calculates cells very slowly and sometimes will not save due to insufficient resources. I have 1gig ram. An example formula might be. =sumproduct((month=a1)*(year=a2)*(salesperson=a3)*(sales) I may have as many as 120 of these formulas on a sheet referencing 12 different salespeople and 10 other key perfromance measures. Is there anything I should look for or change to speed it up? What about save and calculation options on the tools/options tab. I dont know about these. Would it be f...

CBDVariant and GetFieldValue
Hi , CString qStr; CString cText1; CString cText2; CString cText3; qStr.Format("SELECT ID, Text1, Text2, Text3 FROM myTable WHERE ID IN (SELECT MAX(ID) FROM myTable)"); // assume there is one record return, ID (int), Text1- Text 3 (varchar nullable), if (rs.Open(CRecordset::forwardOnly, _T(qStr))) { CDBVariant pID; CDBVariant StrText1; CDBVariant StrText2; CDBVariant StrText3; rs.GetFieldValue((short)0, pID, SQL_C_SLONG); MyID = pID.m_lVal; rs.GetFieldValue((short)1, StrText1, SQL_C_CHAR ); cText1.Format("%s",strText1.m_pstring); rs.GetFieldValue((short)2...