Solved

Using a ListView to display data from an ODBC connection

Posted on 1998-03-01
10
287 Views
Last Modified: 2013-11-20
I am looking for an example of an ODBC database connection
that displays in a listview windows. The CRecordView class
that the wizard builds database program from sets up the
view windows as a formview. I am looking for a class that
is based on the CListView Class. I am not sure on how to do
this as I am new to C++ and MFC......................Dan
0
Comment
Question by:danmiller
10 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1316681
You will need to use a CRecordSet class and fill in your CListView class (or derrived class) by hand.

I'm posting as a comment since I don't have sample source for your precise case. I do have code for a CListBox derrived class though so if you don't get anything better, let me know in a comment and I'll post that as an answer.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1316682
The DAOVIEW sample on the CD (and in help) shows how to hook a CListView to a CDaoRecordset.  In particular, look at the CDaoListView::ShowTableData() function in the file LISTVIEW.CPP.

.B ekiM
0
 

Author Comment

by:danmiller
ID: 1316683
 I took a look at the DAOVIEW sample and it looks interesting
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1316684
Great.  Then, why did you reject my answer?

.B ekiM


0
 

Author Comment

by:danmiller
ID: 1316685
I did not mean to reject Mike's original answer , but is was not
the answer I was looking for. I am looking for more specific
details as to how to connect ClistView to a CRecordSet.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
perrizo earned 100 total points
ID: 1316686
In the last screen of the  App Wizard while creating your project the Wizard asks you if it should create the following classes for you

CApp
CMainFrame
CChildFrame
CDoc
CView

if you click on view you can change the type of view in the combo box below from a record view to a list view.  After you do this you'll have to use Class wizard to add a record set and add some code to the created view class.  Without listing the details of that code, you have to declare a member of your new record set class in your view, look at a recordview to see how they do this and for any other changes you may need to make.  If you want something more specific I can add that then but, I think if you try you'll be able to get it going.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1316687
What more specific details could you want than the code in a known-good sample that you already have?  If you want such infentessimal detail, perhaps you should so indicate in your question:  "I know I only asked for a sample, but I really want you to babysit me as I work on the implementation."

Then, we'll know what the _real_ deal is.

.B ekiM


0
 

Author Comment

by:danmiller
ID: 1316688
Mike I guess you are an expert with and attitude ? , I appologize
for not knowing how to program in MFC , I am just new to it. I
did specifically ask an ODBC question and you gave me a DAO ,
answer..........................................   Dan
0
 

Author Comment

by:danmiller
ID: 1316689
MIke , I was just talking to someone at my work and he convinced that you do not work for Microsoft , nor does he
believe that your wrote your own book any comments ?
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1316690
The technique is exactly the same via DAO or ODBC.

Your colleague is welcome to send an email with his questions directly.

.B ekiM
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

939 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now