473,614 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MFC Database help needed

100 New Member
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 1924
weaknessforcats
9,208 Recognized Expert Moderator Expert
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 New Member
Can u please give me any MFC tutorials or online text book if you have...
May 23 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
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
674
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 generic design patterns that can be used and shared amongst many sub-schemas. For example, the grouping of entities. I may have the following tables: employee, product and client. These tables have no direct relationship with each other. But...
2
3488
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 which each page will use, but my question relates to how to use the database connection i create in all my classes. I have a database class, in a separate namespace and file, i created that handles all the connection opening, executing statements...
19
2734
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 in understanding as much as I can about how I can make this go as fast as possible on a linux system. I haven't run such a large database before. The nature of the database is such that
4
2611
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 simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
9
3108
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 be inserted into a standard web address in the table (the filed name is link) in ddw1 Example address ---
10
7687
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 close' I think that I have read in some threads (althoug I cannot find them now) that others place such tables in a local, linked database. I could do this but I am interested to know what would be the advantages. And disadvantages, if any. Any...
1
2299
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 several different data standards and schema. I'm finding it confusing to keep it all straight. What's this field for? Which standards document is it based on? What are the permitted values? Which business rule governs it? In theory, we do have all...
5
34037
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. My company has two identical web sites. One copy is for our customer, and one copy is for us to test our code changes on. We developed a hard to isolate bug in the copy of the web stie for our
0
4714
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 -Guarantees that no data loss will occur if the primary database fails. To provide this level of protection, the redo data needed to recover each transaction must be written to both the local online redo log and to a standby redo log on at least...
10
3352
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. Data encrypted by AES key 2. AES key encrypted with Asymmetric public key (?)
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8287
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.