Solved

Using a ListView to display data from an ODBC connection

Posted on 1998-03-01
10
295 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
[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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

751 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