Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 1st, 2006, 02:14 AM
Registered User
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default how do i get data from MSaccess by vc++

.. i need to interact with the microsoft access database, take data from it and store it on an ascci file, using visual C++. the storing part is understandable but the getting data from the database part is killin me, i can't find any references in a book or on the net.any help would be highly welcome ...........thanks
Old July 2nd, 2006, 06:15 PM
Registered User
Join Date: Dec 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

This is just in case you still do not have an answer (which I actually doubt a little) or if anybody else comes by...
You will need to create an OleDbDataAdapter and OleDbConnection. For the connection, when creating a new one, you will first select a "provider type", in this case (Microsoft Access) you will need "Microsoft Jet 4.0 OLE DB Provider". You will then select your connection by selecting a database + its username & password (if any). This is all you basically need.

For the Data Adapter, you will simply need to select your connection, create your query and a select, insert & delete command will automatically be created.

All you need then is to read the data and store it somewhere. You could create a datagrid to hold the data, then set its DataSource property to a DataSet, which in turn will be filled by the DataAdapter, as such:

 dataGrid->DataSource = dataSet->Tables->Item[0]->DefaultView;

You can find the DataGrid, Dataset, OleDbDataAdapter and OleDbConnection in your toolbox.
Hope this helps all who come 'round.

Similar Threads
Thread Thread Starter Forum Replies Last Post
populate Gridview from MSaccess data alaqunaibi ADO.NET 1 June 19th, 2006 01:25 AM
Writing to an msAccess db from txtBox Data sconineuk ADO.NET 0 March 8th, 2006 03:13 PM
Secure MSAccess db ASP Data Page Integration Will Woodward Classic ASP Databases 1 October 26th, 2005 08:32 AM
Importing Data to MsAccess ranakdinesh ADO.NET 2 February 24th, 2005 10:03 AM
Accessing a MSAccess table in vc++ using ADO connectprn Classic ASP Databases 0 December 23rd, 2004 03:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.