Solved

Using Visual C++ to connect to DB2 DATABASE

Posted on 2004-04-16
4
420 Views
Last Modified: 2013-11-18
Can Visual C++.Net be used to connect to a DB2 database to create tables and do inserts and deletes?  Will I need any additional software/plugins etc?
0
Comment
Question by:blackula24
4 Comments
 

Expert Comment

by:MarkBordelon
ID: 10848869
Hi, I am quite new at this and therefore a novice at best so please take this with a grain of salt.  I am trying to learn how to do the same thing with an Access .mdb file.  In Visual C++.net, you can use the oleDbDataAdapter to connect to certain databases.  For a disconnnected application, which appears to be where the world is heading due to resource limitations, when you drop the adapter to a form and go to configure it (Press New Connection, then select the Provider tab), there are quite a few providers from which to choose.  For Microsoft Access, it is Microsoft Jet 4.0 OLE DB Provider.  I am not familiar with most of the others (although I reconize some of the more commone ones such as Oracle and SQL) nor am I familier with DB2, however, if you look there you may recognize that one of them will serve as the adapter for which you are looking.  For Microsoft Access, you have to configure this adapter (setting the path to your database file and then pressing the "Test" button to ensure that the link was established.  Once you have this set up, drop and OleDbConnection object to the form.  This will actually connect to the database (as my understanding).  Finally, drop a dataset object to the form.  The dataset object will be used as a storage queue to hold "snapshots" of the dataset that you query from your database using SQL statements. This dataset can hold data from multiple tables without actually using inner joins (not sure if there are such things in DB2 but these do exist in Microsoft Access).  To view the data, you can drop a grid onto the form and use the Fill method to populate it.  
I have gotten this far but do not know the syntax to write the data (after I have made edits in my grid on the form) back to the dataset, and then finally, back to the table(s) in the database in which this infomation is stored.  If you have any information on that I'd appreciate it.
Well, I hope this helps, and apoligize if this is redundant information.  Good luck.
Mark B.
0
 
LVL 7

Accepted Solution

by:
leflon earned 250 total points
ID: 10948307
hi  blackula24,

for C++.Net and DB2 you may take a look at

DB2 Database Project for Visual Studio .Net:
http://www-106.ibm.com/developerworks/db2/library/techarticle/0304alazzawe1/0304alazzawe1.html

DB2 and Visual Studio .NET
http://www-106.ibm.com/developerworks/db2/zones/vstudio/

leflon
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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