Reading one Record at a time till i reach EOF in VC++ using ODBC

Hi,

i am working on Vc++6.0. I hve a req where in i need to read one record
at a time till i reach EOF from the database.Can anyone tell me how to
do this 

Very urgent
Thanks

0
6/6/2006 11:43:10 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
357 Views

Similar Articles

[PageSpeed] 5

Use CDatabase and CRecordSet classes.
// Embed a CDatabase object
// in your document class
CDatabase m_dbCust;

// Connect the object to a
// read-only data source where
// the ODBC connection dialog box
// will always remain hidden
m_dbCust.OpenEx( _T( "DSN=MYDATASOURCE;UID=JOES" ),
                 CDatabase::openReadOnly |
                 CDatabase::noOdbcDialog );
CRecordSet rs;rs.m_pDatabase=&m_dbCust;rs.Open( CRecordset::dynaset,
         _T( "Select L_Name from Customer" ) );
short nFields = rs.GetODBCFieldCount( );
CString varValue ;
while( !rs.IsEOF( ) )
{
   for( short index = 0; index < nFields; index++ )
   {
      rs.GetFieldValue( index, varValue );
      // do something with varValue
   }
   rs.MoveNext( );
}
m_dbCust.Close( );
db.Close( );

<geetu.patil@gmail.com> wrote in message 
news:1149594190.152580.258190@y43g2000cwc.googlegroups.com...
> Hi,
>
> i am working on Vc++6.0. I hve a req where in i need to read one record
> at a time till i reach EOF from the database.Can anyone tell me how to
> do this
>
> Very urgent
> Thanks
> 


0
6/6/2006 11:59:20 AM
Reply:

Similar Artilces:

XML that one of its elements has line break.
Hello, I am using access as my database, One of my columns is memo field, so it has sevral line at its context. Can I convert line break to something readable in XML ? Is there any function for that ? Thanks :) Same thing. Any character, be it ascii or unicode has it's place or number. If Access bitches, it is Access and not Calculus. "Mr. x" <a@b.com> wrote in message news:uaYLyYxeDHA.4024@TK2MSFTNGP11.phx.gbl... > Hello, > I am using access as my database, > One of my columns is memo field, so it has sevral line at its context. > Can I convert line b...

chart area line missing in one pace (with picture)
http://immunizecaadults.org/images/trig.jpg Can anyone tell me why there's a piece of line in the chart area border missing? I checked, and there is no object floating over it. Thanks. If you change the size of the chart area, does the missing postion stay the same? if you change the backgrond color of the chart, what do you see? If you move the chart area in the chart doc, what do you see? If you regenerate the chart what do you get? In other words, I don't know what causes it. "Dave R." wrote: > http://immunizecaadults.org/images/trig.jpg > > Can anyone...

GetOpenFileName + Using own dialog template
Hi. I have a question: I am using the GetOpenFileName function to display the Windows FileDialog. I want to use the EXPLORER functionality and therefore I declared the flag OFN_EXPLORER in the OPENNAME-structure. Now here is the problem: I want to use my own dialog-template instead of the standard-file-open dialog. So i wrote my own template and set the attribute templateName of the OPENNAME structur to my own template. Furthermore i activated the flag OFN_ENABLETEMPLATE. But when I call the GetOpenFileName function with these properties I get the errorcode CDERR_GENERALCODES and the dialog is...

Continuous Form Use
I created a form similar to an Access form. It's for logging in phone calls and messages. Is there a way to set it up like in Access where a single form appears on 1 page but can generate subsequent pages within the file? Or is setting it up as a table the only way it can be done? Our IT contractor doesn't want me to use Access otherwise this would be a breeze. Any suggestions or help is appreciated. Thanks. You can spawn forms off a form, and access the data on that form. -- HTH RP (remove nothere from the email address if mailing direct) "ryjack" <ryjack@disc...

Comments using Validation input
A few days ago a question relating to comments grabbed my attention. The reply informed us that the comment in question was able to be seen by clicking the cell it was attached to and as long as that cell remained active the comment could be seen. So we have a comment which is not a comment visible only when the cell is selected as opposed to a comment which is visible when the cursor is over the cell. Sounds confusing but it achieves the result of showing a "floating" comment which remains in the same place on the screen even when it applies to a cell in a 'frozen' section a...

Using cell reference with logical operator in DGET expression
I am using DGET to search an array in the worksheet to find a particular percent to use in a calculation elsewhere in the spreadsheet. The row members of the array contain a series of from and to values that I use to identify which row has the percent I am looking for. I have defined the array as a range and I can use the logical operatirs with numeric values in the range criteria and everything works fine. For example, I can use <500 in the appropriate cell in range criteria to find the percent to use when the value for that column in the array is less than 500. All working f...

Receivable transactions using Integration Manager
Hi, I'm new to Integration manager and while trying to import receivable transactions of type "invoice" into Great Plains using Integration Manager, I receive the following errors: ERROR: Field 'Customer ID' does not have a default value. ERROR: Field 'Distribution.Distribution Account' does not have a default value. I am using a tab delimited text file for import. Customer Id is of the format 000001 Distr. Account is of the format 9999-999-99-99-99 Can anyone help me with this. Check each one of your mapping and make sure it says 'use source' an...

Update blank/null fileds with value of previous row using update q
Hi, I need to fill the blank fields with the value of the same field of the previous record. For example : 3 fields in the tableA, 4 records. FIELD1, FIELD2, FIELD3 G5AA,EVA,ABC <blank>,EVB,<blank> G5BB,<blank>,<blank> G5CC,EVC,DEF Expected result : G5AA,EVA,ABC G5AA,EVB,ABC G5BB,EVB,ABC G5CC,EVC,DEF How should I do this? Many thanks. Methinks you are attempting to "commit spreadsheet" upon a table in a Access database. The concept of "previous record" is essentially meaningless in a table in a properly-designed relational database. If...

how i can change default file format Outlook uses to save message
I my saving message in my inbox using "File->Save As" menu. "Save As.." dialog by default shows "Save As Type:" as "HTML". How I can change default file format Outlook uses to save messages to as "Outlook Message Format - Unicode" ?????? Rajkumar <Rajkumar@discussions.microsoft.com> wrote: > I my saving message in my inbox using "File->Save As" menu. > "Save As.." dialog by default shows "Save As Type:" as "HTML". > How I can change default file format Outlook uses to save messages...

combine multiple excel file in to one excel file and multiple worksheet
I am wanting to use the following code to combine worksheets from multiple files. However I would like to be able to select folder which contains files in a more automated way that having to change the code every time, and also copy all worksheets with links and formulas removed. Any help on this is greatly appreciated as I have limited code knowledge. Sub Copy_them() > Dim TargetWkbk As Workbook > Dim mrgWkbk As Workbook > Dim i As Long > Dim Wks As Worksheet > Dim fName As String > Application.ScreenUpdating = False > Set TargetWkbk ...

Time out OWA
i have a problem with owa, when i connect it does not happen but of 2 minutes and it gives to Time out me, "expired conecction", i have nt 4.0 and exchange server 5.5 sp4, i check options and everything is normal salu2 Ruben R. "Ruben Rozas" <pipen@uplink.cl> wrote in news:003c01c3c59a$13b80b90 $a601280a@phx.gbl: > i have a problem with owa, when i connect it does not > happen but of 2 minutes and it gives to Time out > me, "expired conecction", i have nt 4.0 and exchange > server 5.5 sp4, Has it ever worked correctly? Is the OWA serve...

Multiple emails for one contact in distribution list
I have created a group to send out bi-monthly emails from my personal email account. One of the people in the group would like to have the email sent to her work email and to her personal email. I have attempted to add both email addresses to the group, and initially it does. After syncing, however, the personal email disappears from the group list because it is not the primary email listed in the contact. Is there a way to include both email addresses without creating a separate contact for just the personal email? I am running Outlook 2010 beta. My email is through Hotmai...

select query of parent and child in one row
I have a parent table and a child table one parent has between 1 and 6 children in the child table I wont a query to have the parent and the child in one "row" how do I create that? thanks for helping me Your table structure is not correct for a relational database but this will get you there. This has three but you get the idea and expand on it. Place the table in the design grid as many times as you have field to combine. SELECT MultipleFieldData.x, MultipleFieldData.a & IIf(MultipleFieldData_1.b Is Null,Null," " & MultipleFieldData_1.b) & IIf(MultipleF...

External data query using MAX/SUM
I'm trying to create an external data link using Microsoft Query. Ho do I write SQL in Microsoft query that will return a max date and su an amount field for the max date only? Current SQL is as follows: SELECT DISTINCT CB_PORTFOLIO_DMN.PORTFOLIO_NAME Max(CB_POOL_PORTFOLIO.POST_DATE), Sum(CB_POOL_PORTFOLIO.EXPOSURE_AMT) Count(CB_POOL_PORTFOLIO.NBR_AVG_MATY_YRS) FROM CB06U.CB_POOL_PORTFOLIO CB_POOL_PORTFOLIO, CB06U.CB_PORTFOLIO_DM CB_PORTFOLIO_DMN WHERE CB_PORTFOLIO_DMN.PORTFOLIO_ID = CB_POOL_PORTFOLIO.PORTFOLIO_ID GROUP BY CB_PORTFOLIO_DMN.PORTFOLIO_NAME This returns the sum of the exp...

List of fonts used in a Word doc -- the easy way
The VBA scripts that I have found all implement a character-by-character scan throu= gh the document, which can take a long time in later versions of Word. You can blame Wor= d's "formatting" feature for the slowdown. There=E2=80=99s a faster way: Save the document in .rtf format, then open the .rtf fi= le in a text editor such as notepad.exe. The fonts are listed in a font table ( {\fonttb= l ) located at the very beginning of the file. Each font entry looks something like thi= s: = {\f0\froman\fprq2\fcharset0 Times New Roman;} Any entries with a character set ...

convert time into decimal #2
=IF(E44="","X",E40-E44) the formula above where E40 is the time now, and E44 is the time of 2 hours ago. I want to return 2 instead of 2:00 PM. How do I do this? I do this but it does not work (E40-E44)*24. ...

Reading UUENCODE
For some reason when a client is sending UUENCODE type messages to my Exchange Server the Clients can not ready the Email or the Attachments. All Attachments are arriving with the same size and when opened display as a X. Has anybody seen this problem before ...

Can I print one page landscape and the next page portrait on same.
I am trying to print the 3 pages of one worksheet and can not figure out how to make page one print out as landscape, page 2 to print out as portrait and page 3 to print out as landscape. I'd record a macro when I printed page 1 as landscape, then page 2 as portrait and then page 3 as landscape. So I could just rerun that macro when I needed it. lisajillian wrote: > > I am trying to print the 3 pages of one worksheet and can not figure out how > to make page one print out as landscape, page 2 to print out as portrait and > page 3 to print out as landscape. -- Dave Pet...

sending email from outlook using AOL
After much exasperation have finally got outlook to send email whilst using my AOL internet connection. The issue is that I have to have my aol email address entered in the Outlook email box but I use my outlook email address in the reply email address box. The problem is that any recipient of an email from outlook will see my aol email address in the from box and if they click on reply it will be sent to my aol email box and not to my outlook email box. If my aol email address is not entered, in the Outlook email box, the email is rejected by aol. Using AOL 9 & Outlook 2002 Any ...

Music files using "Package for CD" Option in Powerpoint
I am trying to burn my show onto a disk, and the show has songs linked to it. I know the songs are not embedded into the show, so I was looking for a solution for this. I saw the "package for CD" option in the menu and according to that, it is supposed to take your show, and all linked files and burn it onto a disk to be played back using powerpoint viewer. I made sure the box was checked to include linked files. After the disk burned, no music. I tried putting all the music and show in one folder and then running the package for cd tool, still no music. Is ther...

Conditional Summing across ranges using arrays
Hi all - I'm struggling to find a formula that will solve my problem: I have a matrix of numbers defined by a series of numerical column and row headers. RefCel 1 2 3 4 5 . . . m 1 a # # # # 2 # # # # # .. 5 b # # # # .. n # # # # # What I'm trying to do is for a give column header and a subset of row headers, sum the intersecting values. Let's assume that the subset are held in a named range Subset and the row and column headers are in range called RowHead and ColHead and...

Outlook Express downloads all email to one family user
I've set up a new PC. All of my Epxress POP3 and SMTP information is entered correctly, and I have entered five email addresses into Express (one Main account and four others) My problem concerns receiving email. When logging into Express, all undelivered email for all five accounts is downloaded to the first account Express opens. For example, there are six pieces of underlivered email this morning -- two addressed to the "Dad" account and four addressed to the "Mom" account. Child 1 opens Express and signs into his account and the six emails are downloaded to the...

Using a txt string in formulae
Right this is an anoying little beggar but probably simple and im failing to see the wood from the trees so to speak ! right i have a workbook with multiple sheets and a front sheet the front sheet reports results of counts from the other sheets using =COUNT(sheet1!A:A) and =COUNTIF(Sheet1E:E,"Neg room") and other similair formula my question is this In column A i have the name of the sheet so I.E. A1=sheet1 which hyperlinks to the named sheet and columb B has the first formulae and so on and so on! my question is is there a way i can add the Word name of the sheet the Count form...

how do i autofill without using mouse?
how do i autofill without using mouse? anyone here know the shortcut for this? thank -- Message posted from http://www.ExcelForum.com Alt + E + I +S & Enter for 1, 2 etc.. -- Regards, Peo Sjoblom "sokevin >" <<sokevin.10x964@excelforum-nospam.com> wrote in message news:sokevin.10x964@excelforum-nospam.com... > how do i autofill without using mouse? > > anyone here know the shortcut for this? > > > thanks > > > --- > Message posted from http://www.ExcelForum.com/ > ...

Microsoft Publisher 2002
All of a sudden I can no longer even open Microsoft Publisher on my son's computer. Recently there was an Windows update that referred to program authentication. We had installed this publisher program on this computer after our previous computer crashed but we only have it running on one computer so this is very frustrating! I have tried reinstalling the program to no avail. I would be extremely grateful if there was a solution to this problem. Use the phone activation and explain. 888-652-2342 (Not sure this number is still valid) Was the program installed when you bought...