Re: Is Any familar with Pro*C calls in Visual C++/MFC
Date: 1998/04/14
Message-ID: <353372CB.C0B8B24A_at_debis.com>#1/1
Joerg Reiner wrote:
> Hello,
>
> how can I embed Pro*C commands in an C++ or more specific
> in an Visual C++ / MFC program. Is there any chance?
> Up till now i find no solution. Either with the CODE=CPP option nor
> PARSE=NONE or something.
> Where must I place the code or write a special "Connection"-Class.
>
> Any help is appreciated
>
> Joerg
This message has been written by Mark Tomlinson a few weeks ago. Hope it helps...
The following steps provide a guide to creating a very basic Dialog box based Pro*C application in Microsoft Visual C. This assumes you are familiar with both products...(This may have been done with 4.x rather than 5.x, but the steps would be very similar).
24 steps to a basic MSVC Pro*C application:
- File -> New -> Project Workspace
- MFC AppWizard (exe) and give it a name (for this example 'TEST')
- Type = Dialog based / Language = U.S. English
- Click Finish
- Click OK (when shown the project information)
- Once the project is created, click on the ResourceView tab
- Click on the Dialog sub-folder
- Click on IDD_TEST_DIALOG
- Add an edit field to the dialog using Controls editor
- Add a button to the dialog using Controls editor
- Press the Ctrl+W buttons
- Click the Message Maps tab in the MFC Class Wizard
- Select the CTESTDlg class in the class name drop down
- Click on IDC_BUTTON1 in the Object IDs
- Click on BN_CLICKED in the Messages list
- Click OK (when the Add Member Function dialog pops up)
- Click OK (dismiss the MFC Class Wizard)
- Open the TESTDLG.CPP file in the editor
- Locate the line: void CTESTDlg::OnButton1() -and- set the following code there:
extern"C"
{
#include "d:\orant\pro22\c\include\sqlca.h"
}
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR v_loc[20];
char* connstr = "scott/tiger_at_t:myserver:ORCL";
EXEC SQL END DECLARE SECTION;
void CTESTDlg::OnButton1()
{
// TODO: Add your control notification handler code here
EXEC SQL CONNECT :connstr;
EXEC SQL SELECT loc INTO :v_loc FROM DEPT WHERE deptno = 40;
EXEC SQL COMMIT WORK RELEASE;
v_loc.arr[v_loc.len+1] = 0;
SetDlgItemText(IDC_EDIT1,(char*)v_loc.arr); }
20) Save the modified TESTDLG.CPP to TESTDLG.PC 21) Precompile TESTDLG.PC to TESTDLG.CPP using the CODE=CPP option. 22) Add the following include to the top of the TESTDLG.CPP file:(see BUG 346844)
#include "stdafx.h"
23) Ensure that SQLLIB18.LIB is included in the project. 24) Compile and link the program
-- Dietmar Leibecke debis Systemhaus GmbH ---------------------------- Opinions are mine and do not necessarily reflect those of my employerReceived on Tue Apr 14 1998 - 00:00:00 CEST