Solved

Using a ListView to display data from an ODBC connection

Posted on 1998-03-01
10
286 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
Comment Utility
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
Comment Utility
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
Comment Utility
 I took a look at the DAOVIEW sample and it looks interesting
0
 
LVL 11

Expert Comment

by:mikeblas
Comment Utility
Great.  Then, why did you reject my answer?

.B ekiM


0
 

Author Comment

by:danmiller
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Accepted Solution

by:
perrizo earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

10 Experts available now in Live!

Get 1:1 Help Now