I have a question with repeat open and close table

hello,everybody:

  I write one thread with use Vc6 IDE and I need repeat read data from table
,

  but it had throw error message when my application is runing.

  Error message is:

    This application has requested the Runtime to terminate it in an unusual
way.
    please contact the application's support team for mor information��

  My segment of code fellow:

/*
  return false if empty data
*/
bool CReadData::OpenTable()
{
   ASSERT(m_pConn != NULL);           //ado connection
   ASSERT(m_pTable_SMO != NULL);      // table
 try
 {
     if (m_pTable_SMO->GetState() & adStateOpen)
       m_pTable_SMO->Close();                       //close my table

    m_pTable_SMO->Open("select * from t_sminorder",  //open my table
        m_pConn.GetInterfacePtr(),
        adOpenDynamic,
        adLockOptimistic,
        adCmdText);

  bool Empty = (bool)m_pTable_SMO->ADOEOF;
  if (!Empty)
     m_pTable_SMO->MoveFirst();
   return !Empty;
 }
 catch(_com_error *e)
 {
     return false��
  }
}


I need repeat read data from table in my thread code,

/*
  it process repeat data in my thread
*/
 DWORD WINAPI CReadData::Read_MO(void* lpParam)
{
 ...
 while(1)
 {

   if( pRd->OpenTable() == false)         //read data from table
     continue;
   ....
   ....
  }
}

It wouldn't any exception when I add one sentence with Sleep(1000) ,
Why don't rapid read data?

I write other code in CBuilder,write simple code with repeat open and close
table, fellow

fastcall void TForm1::Button1Click(TSender : Sender)
{
   while(1)
   {
     adoTable1.close();
     adoTable1.open();
   }
}
  it is good for rapid read data from table, it explain the ADO support to
rapid  open and close operate,
 but why don't rapid close and open in VC6?

 Please master-hand give me directions....



0
6/8/2006 11:56:57 AM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
466 Views

Similar Articles

[PageSpeed] 39

Reply:

Similar Artilces:

Form for table
Here's the problem: Access 2003, XP Pro- I have three tables that are related by primary keys. I have a table[Table QC] that has the field [EmployeeID], the data type is number--that field is linked to the autonumber primary key of the Employees Table. So far so good. I am trying to make a form that has a combo box that looks to the Employee Table to get me the drop down of the employees (Last Name, First Name). The SQL statement builds out okay, and I get the correct name config., but because the data type is a number it won't accept the data. I looked at the Northwind example and i...

Excel 2003 extract repeating cells
I have successfully sorted my data to show repeating entries in relation to two specific columns. I can't seem to figure out how to select these repeating entries (without doing it manually, of course) and putting them either into their own column(s) or an entirely different spreadsheet altogether. The goal is to save time in managing THOUSANDS of documents in this manner so that my colleagues can easily pick up repeating entries and take according action. Doing it manually is very time-inefficient. Nit Wit, You don't really describe enough of your layout or what you actually mean...

Baseball Stats question: How can I get the RBI's?
I have a data table that looks like this: Code ------------------- STR-S SNK-S STR-K STR-F SNK-S STR-3 STR-2 STR-F SNK-S SNK-4 SNK-S STR-3 SNK-F STR-4 STR-O ------------------- "STR", etc at the beginning are pitch types, SNK is Sinker for example The end character is the result of the pitch, a 4 would be a home run, 3 a triple, and so forth. O is out, F is foul, S is strike --- you ge it. How can I figure the amount of RBI's? I know that it's 5, but I can' think of any automated way to calculate this, anyone got any ideas? THANK YOU!! :confused -- AVER...

Web Query question
I am trying to download stock options through the following vba code, however i am having problem with separator between "m" field which is month and "s" field which is stock symbol, I appreciate any help i can get, With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://finance.yahoo.com/q/op?s=" & Range("b1").Value;&m=2010-05", Destination:=Range("$A$11")) thanks david I think you are mising (at least) one quote? Reg Migrant "David" wrote: > I am trying to download stock optio...

SUMIF function not calculating from closed worksheet
We recently upgraded from Microsoft Office 2000 to 2007. Prior to the upgrade each department would access a spreadsheet that would load data from a common lookup spreadsheet The loading process was performed as follows: The lookup file and each department file would be opened to update the link for that month and then saved and closed. When the department head would open the department file, a question would appear asking if they wanted to update the link, if they answered no the spreadsheet would open and display the calculated data. If they answered yes, the file would o...

Publisher file made in Publisher 2007 won't open in 2007
I produced an 8.5 x 11 brochure two days ago in Publisher 2007. I was able to save, resave and reopen the file many times during the day. When I tried to open the file today, I get the "Publisher cannot open the file" error message. I've tried to open the file on two different machines with Publisher 2007 and get the error message both time. One has XP Pro, the other has Visa Home Basic. It's a 1.6 meg file. I have a smaller publisher file of a bumper sticker (40 kb) which was made a couple of weeks ago which opens with no problem. This is the second time I ha...

preview text disappears when email is opened
When someone responds to an my email, I can see what they have typed - until I open the message - then only my original message is viewable. The preview pane shows new message text when email arrives, hoever when the email is opened the preview text disappears - and I just see the earlier part of the message which I had sent. If I mark it as unread it does not return to the previous state. This seems to happen on email responses that people have received and answered from a webmail service not that they downloaded and opened in outlook on their PC OL'03 XP pro sp2 -- Respectfully,...

Count unique values
Hi, I've some problems to count unique items (Invoice #) in a pivot table. There is the default solution "Add-a-new-calculated-column" as mentioned on http://contextures.com/xlPivot07.html#Unique, but in my case, it doesn't works. My problem is, that these values aren't in a Excel worksheet; it's a external data source - a SQL-Select via DAO/ADO. Because of that, I don't have the possibility to add a new column. Another reason is, that the pivot table should always be dynamic: Group over this field, group over another field - and always show the number of unique...

can't open files
I have Microsoft Office 2003 ~ all of a sudden when I go to my documents and try to open a file, I get this message "problem sending command to the program". Error 0646 and dt000 See the article "How to re-register Word when problems crop up opening files” at: http://www.word.mvps.org/FAQs/AppErrors/ReRegisterWord.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Lost in Vegas" <Lo...

AD/Network design question
Hello all I have a 2 sites which users come and go from. These sites have 2 different network ip domains (192.168.1.x and 192.168.2.x). Users need to be authenticated using the same user id and password at both sites. DC/GC is at 192.168.1.x and is a SBS 2003. Server at 192.168.2.x is Server 2003. When the server at 192.168.2.x is connected via vpn to 192.168.1.x all is well. How do I get the server at 192.168.2.x to act as a AD/DC when it’s not connected to 192.168.1.x ? Thank you Hal I think you will run here into the limitations of SBS :-( @ SBS experts : ...

Opening for Great Plains Developer in SF Bay Area
Hi, We have a current position open for a Great Plains developer to perform dB maintenance for Great Plains installation. Open to Contract or Contract to Perm. Full job description on request. Please email if you are interested. Thanks, Brendan McIntyre brendan@emailpcs.com ...

toggling between open work books
Re EXCEL97 under WinXP-Pro w/SR-2 Microsoft Windows allows you to easily toggle between applications using Alt-Tab. Is there a similar key board to toggle between two open workbooks in Excel? One can use Alt-W to display list of open workbooks, but you can�t just blinding hit the up or down arrow, because the most recently accessed workbook is not always at the top or bottom. I realize that I could get around the problem of opening two copies of Excel and then toggling using the Alt-Tab keys, but typically I�ve got two workbooks open in one copy of Excel before I realize I need the f...

Office 2010 Buying Question Assistance Needed
I've been looking through the MS Office 2010 web site to try to determine what my new small company would require, but I can't find the information I need. We for sure would need Office Pro Plus, but other than that I'm not sure. We want to run it on our own server. We will initially have 3-5 people using it and perhaps more later on. Would we need to purchase site licensing? Unfortunately, our programmers are MS haters (I'm not) and I can't get any assistance from them on this, but I have power of the pen. I would appreciate any assistance I can get. Th...

List Running Horizontally-Pivot Table Possible?
I just had a customer ask this one and I'm not so sure about it. 1) The customer has setup a list of information that is running horizontally instead of the typical list running vertically. 2) I just taught him how to do pivot tables and he wants to generate a pivot table with his "horizontal" list. 3) I know he can copy and paste special and use the Transpose feature to change the list from horizontally oriented to vertically oriented. 4) the question is: can he leave the table in its original orientation and still generate Pivot tables? I can't seem to make it work ...

Open Workbook
I have a query that pulls 2 fields from a table. One field (ReportName) is selected from a form combo box. The second field (ReportLocation) in the query is the full path of the ReportName selected. I want to open the workbook using the ReportLocation, when the ReportName in the form changes. So I need to the code to enter in "On Change" for my form, so whatever report is selected, it opens up. Please help. Thank you in advance. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200802/1 here is my current code that doesn'...

Question About Missing Data
So, this is probably really easy, but I just want to ask and see if I may be missing something here. Some data on vendor numbers changed. Let’s say IBM used to have a vendor number 12345 and now it’s vendor number is 56789. I can identify IBM as IBM, but I really want to use the number, not the name. Should I set up a table that ties the numbers together, so that Access knows 12345 = 56789? Or, should I do some kind of Update Query and change all incidences of 12345 to be 56789? Or, is there some other, method, like a ‘best practices for missing data’? Thanks! Ryan--- ...

Custom CRect Question
I have a custom rectangle class that inherits from CRect: class CCustomRect : public CRect { private: CPoint m_maxPt; COLORREF m_color; TCHAR text[50]; public: CCustomRect(RECT* source, CPoint pt, COLORREF rgb); RECT* RectBase(); void Update(RECT* r); } Inheritance has worked well until I found myself needing to create the RectBase function (above) to return the rectangle dimensions. CRect does not seem to have any methods that can be called to return the base class's RECT value. I could take CRect::Size and construct a rectangle to return, but this seems a bit much. My...

VS 2005 beta question
All, I need to complie some code. I am going from 16bit to 64 bit. The job do not want to spend the money on VS 2005.net. If I compile the code with the beta version or trial version of VS 2005.NET will it time bomb on me? Thanks in advance The code won't, but eventually the compiler will stop working. Don't know if the trial will support 64 bit though. I guess you get what you pay for. Tom "karibbean" <sharp_mind@REMOVE.this.email.msn.dotcom> wrote in message news:%23OyZFNUFGHA.1124@TK2MSFTNGP10.phx.gbl... > All, > > I need to complie some cod...

Why do my questions get deleted sometimes?
Apologies, I have posted this on the worksheet functions group too... I love the feedback I get from these groups, but every now and then, my messages get deleted. I'd like to know what I'm doing wrong. Many of my messages ARE posted and answered, and I'm grateful for that, but one or two get removed - regardless of how often I post them. I don't swear or say anything bad about Excel - I love it. So why don't they get posted are there some words or subjects that I should avoid? Will this one get deleted - it's a bit off subject? But I'd love to have an ans...

Named ranges
Excel 2003 I have a total sheet that gets data from three different shift sheets (all in the same workbook) for a monthly report. I have named ranges on each shift sheet for each month's production data (S1M1, S1M2, S1M3, S2M1...) where S1M1 =A2:AC147, S1M2 = A148:AC329, etc. The old formula was:=SUMIF('SHIFT 1'!$L$1:$L$147,"BB",'SHIFT 1'!$T$1:$T$147). I'm stumped as to what the new formula would be - how would I direct Excel to column L of S1M1 to search for "BB", then add the contents of column T? The range changes each month, and I tho...

Outlook 2003 process doesn't shut down on closing
Hello, When I close down Outlook 2003 SP3, the outlook process continues to run and the Outlook icon remains in the Taskbar. Windows XP Pro SP2 fully patched. Any ideas? Thanks, Steve Do not multi-post. See your answer in m.p.office.misc. --=20 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After furious head scratching, Maincat asked: | Hello, |=20 | When I close down Outlook 2003 SP3, the outlook process continues to | run and the Outlook icon remains in the Taskbar. Windows XP Pro SP2 | fully patched.=20 |=20 | Any ideas? |=20 | Thank...

Emails are automatically opening
When I select an email in outlook xp the emails are automatically opening the first highlighted email. Yes, ;) I have checked my settings in folder views - double click is selected, even if I reset it to single then back to double still no go. Also once I close a message, the next one automatically opens - just close not move or deletes. ...

Repeat statements "x" number of times...
Hi All, I have the following code at the end of a long macro: Columns("D:D").Find(What:="total").Select ActiveCell.Offset(0, 4).Range("A1").Select ActiveCell.FormulaR1C1 = "=Sum(RC[-1]-RC[-2])" ActiveCell.NumberFormat = "0.00" ActiveCell.Font.Bold = True With ActiveCell.Interior .ColorIndex = 6 End With What I am doing is when the word "total" appears, it will go to the cell 4 columns to the right, and then do a formula and format the cell. Question: How can I get this to repeat itself for eac...

hide/close/delete shared account
(bear with me. i'm new and although this is my second time trying to set up money, i've run into the same problem and have yet to find the answer in the forum.) i have four bank accounts and one is shared with a family member. i don't want this account to show up at all in money essentials. i tried "closing" it. i tried "hiding" it. i tried "deleting" it. but each time i go back to "categorize my transactions," transactions from that account are still there. The problem here is that Money is designed (and Money Essentials (MEss) even ...

A question about CToolTipCtrl.
Hi All: Chinese English following! I add a CToolTipCtrl member in my dialog, and create it in OnInitDialog function, at last, I add a CEdit control to CToolTipCtrl member.When the CEdit control is enabled, tool tip can pop up normally, but when the CEdit control is disabled, tool tip can't pop up. How can I solve this problem? Thanks. Fiveight Take a look at http://www.codeguru.com/forum/showthread.php?t=309050&highlight=CToolTipCtrl+disable -- If the message was helpful to you, click Yes next to Was this post helpful to you? Regards, Goldbach "fiveight" wrot...