Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using a ListView to display data from an ODBC connection

Posted on 1998-03-01
10
Medium Priority
?
306 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

926 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