473,320 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MFC Database help needed

100 100+
Hi,
I am new to this and i am trying to write a code to have a UI (MFC) to insert into database.

I created a new project with datadase connected to it.
But once i created the project it gave me a lot of CPP files and headers.
i dont know where to make modification.

my code in one of the CPP file is here
Expand|Select|Wrap|Line Numbers
  1. // Database.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Database.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "DatabaseSet.h"
  9. #include "DatabaseDoc.h"
  10. #include "DatabaseView.h"
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CDatabaseApp
  20.  
  21. BEGIN_MESSAGE_MAP(CDatabaseApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CDatabaseApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27.     // Standard print setup command
  28.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  29. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CDatabaseApp construction
  33.  
  34. CDatabaseApp::CDatabaseApp()
  35. {
  36.     // TODO: add construction code here,
  37.     // Place all significant initialization in InitInstance
  38. }
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // The one and only CDatabaseApp object
  42.  
  43. CDatabaseApp theApp;
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CDatabaseApp initialization
  47.  
  48. BOOL CDatabaseApp::InitInstance()
  49. {
  50.     AfxEnableControlContainer();
  51.  
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57. #ifdef _AFXDLL
  58.     Enable3dControls();            // Call this when using MFC in a shared DLL
  59. #else
  60.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  61. #endif
  62.  
  63.     // Change the registry key under which our settings are stored.
  64.     // TODO: You should modify this string to be something appropriate
  65.     // such as the name of your company or organization.
  66.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  67.  
  68.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  69.  
  70.     // Register the application's document templates.  Document templates
  71.     //  serve as the connection between documents, frame windows and views.
  72.  
  73.     CSingleDocTemplate* pDocTemplate;
  74.     pDocTemplate = new CSingleDocTemplate(
  75.         IDR_MAINFRAME,
  76.         RUNTIME_CLASS(CDatabaseDoc),
  77.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  78.         RUNTIME_CLASS(CDatabaseView));
  79.     AddDocTemplate(pDocTemplate);
  80.  
  81.     // Parse command line for standard shell commands, DDE, file open
  82.     CCommandLineInfo cmdInfo;
  83.     ParseCommandLine(cmdInfo);
  84.  
  85.     // Dispatch commands specified on the command line
  86.     if (!ProcessShellCommand(cmdInfo))
  87.         return FALSE;
  88.  
  89.     // The one and only window has been initialized, so show and update it.
  90.     m_pMainWnd->ShowWindow(SW_SHOW);
  91.     m_pMainWnd->UpdateWindow();
  92. //AfxMessageBox("Database error");
  93.  
  94.     return TRUE;
  95. }
  96.  
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // CAboutDlg dialog used for App About
  100.  
  101. class CAboutDlg : public CDialog
  102. {
  103. public:
  104.     CAboutDlg();
  105.  
  106. // Dialog Data
  107.     //{{AFX_DATA(CAboutDlg)
  108.     enum { IDD = IDD_ABOUTBOX };
  109.     //}}AFX_DATA
  110.  
  111.     // ClassWizard generated virtual function overrides
  112.     //{{AFX_VIRTUAL(CAboutDlg)
  113.     protected:
  114.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  115.     //}}AFX_VIRTUAL
  116.  
  117. // Implementation
  118.     CAnimateCtrl *Player;
  119.  
  120.  
  121.     BOOL OnInitDialog();
  122. protected:
  123.     //{{AFX_MSG(CAboutDlg)
  124.         // No message handlers
  125.     //}}AFX_MSG
  126.     DECLARE_MESSAGE_MAP()
  127. };
  128.  
  129. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  130. {
  131.     //{{AFX_DATA_INIT(CAboutDlg)
  132.     //}}AFX_DATA_INIT
  133.  
  134. Player = new CAnimateCtrl;
  135.  
  136. }
  137.  
  138. BOOL CAboutDlg::OnInitDialog()
  139. {
  140.     CDialog::OnInitDialog();
  141.     RECT Recto = { 5, 5, 360, 360 };
  142.  
  143.     Player->Create(WS_CHILD | WS_VISIBLE | ACS_TRANSPARENT,
  144.     Recto, this, 0x1884);
  145.     Player->Open("F:\\svs\\sarabhai_yamadoot.wmv");
  146.  
  147.     return TRUE;
  148. }
  149. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  150. {
  151.     CDialog::DoDataExchange(pDX);
  152.     //{{AFX_DATA_MAP(CAboutDlg)
  153.     //}}AFX_DATA_MAP
  154.     CDatabase database;
  155.         database.ExecuteSQL("select * from raghava");
  156.     database.CommitTrans();
  157. }
  158.  
  159. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  160.     //{{AFX_MSG_MAP(CAboutDlg)
  161.         // No message handlers
  162.     //}}AFX_MSG_MAP
  163. END_MESSAGE_MAP()
  164.  
  165. // App command to run the dialog
  166. void CDatabaseApp::OnAppAbout()
  167. {
  168.     CAboutDlg aboutDlg;
  169.     aboutDlg.DoModal();
  170. }
  171.  
  172. /////////////////////////////////////////////////////////////////////////////
  173. // CDatabaseApp message handlers
  174.  
  175.  
can any one please help....
May 22 '07 #1
3 1896
weaknessforcats
9,208 Expert Mod 8TB
Here's where you need to read up on MFC. It's too much to explain. I hope you have the MFC textbook.
May 22 '07 #2
rag84dec
100 100+
Can u please give me any MFC tutorials or online text book if you have...
May 23 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Programming Windows with MFC - Jeff Prosise ISBN: 1572316950.
.
May 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
2
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info...
19
by: Andy B | last post by:
Hello, Sorry for this newbish question. Briefly, my problem: ------------------ I expect the database I'm working on to reach something in the order of 12-16 Gigabytes, and I am interested...
4
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
1
by: Eric Sadoyama | last post by:
I have a database documentation question, but I am not even sure how to phrase it properly so I don't know where to start looking for answers. We are developing a database that is based on...
5
by: Steve | last post by:
Hi; I thought I would rephrase a question I asked in another post to more quickly get to the heart of the matter. My apologies for anyone who is offended by what appears to be a repetition. ...
0
by: Vinod Sadanandan | last post by:
STANDBY DATABASE MONITORING & PROTECION MODES (9iR2) This document is written for understanding and monitoring standby database configured with diffrent protection modes . MAXIMUM PROTECTION ...
10
by: Les Desser | last post by:
In article <fcebdacd-2bd8-4d07-93a8-8b69d3452f3e@s50g2000hsb.googlegroups.com>, The Frog <Mr.Frog.to.you@googlemail.comMon, 14 Apr 2008 00:45:10 writes Not sure if I quite follow that. 1....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.