Solved

Using Visual C++ to connect to DB2 DATABASE

Posted on 2004-04-16
4
390 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

21 Experts available now in Live!

Get 1:1 Help Now