Solved

Using Visual C++ to connect to DB2 DATABASE

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cannot Load "PROGRA~1\MICROS~2.0|Common7\Packages\FPACUT~1.DLL" 10 280
.Net Errors Service Crashing 5 113
payment gateway plugin 7 123
Recommend web chat service 1 127
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…
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…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

16 Experts available now in Live!

Get 1:1 Help Now