目的是将SUN等服务器产生的日志文件--文本格式,写入到SQL SERVER数据库,实现功能为:
1.修改源日志格式为以逗号分割字段,写入成一个新的日志文件。
2.程序读出新日志文件,写入到数据库(分别利用RecordSet和存储过程实现)。
由于是初学VC,不当之处请高人指正,万分感谢!
第二部分
工程名称为vcado,如下是在vcado.h中的重要源代码!
class CVcadoApp : public CWinApp
{
public:
CVcadoApp();
_ConnectionPtr m_pConnection;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVcadoApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CVcadoApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
如下是在vcadoDlg.h中的完整源代码!
// vcadoDlg.h : header file
//
//{{AFX_INCLUDES()
#include "adodc.h"
#include "iostream.h"
#include "datagrid.h"
//}}AFX_INCLUDES
#if !defined(AFX_VCADODLG_H__98A03206_EDFA_42CD_BB0A_7CB271993230__INCLUDED_)
#define AFX_VCADODLG_H__98A03206_EDFA_42CD_BB0A_7CB271993230__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CVcadoDlg dialog
class CVcadoDlg : public CDialog
{
// Construction
public:
BOOL m_bAutoSave;
void SaveData();
void LoadData();
_variant_t vdatetime,vname,vname2,vip,vexplain;
BOOL m_bSuccess;
int m_nCurrentSel;
int nItem;
_RecordsetPtr m_pRecordset;
_ConnectionPtr m_pConnection1;
_CommandPtr m_pCommand;
CEdit *pedit1;
CEdit *pedit2;
CEdit *pfileopen;
CStatic *pstringadd;
CString explain;
CString name;
CString name2;
CString ip;
COleDateTime datetime;
CString datetime2;
CVcadoDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CVcadoDlg)
enum { IDD = IDD_VCADO_DIALOG };
CEdit m_datetime2;
CEdit m_name2;
CEdit m_name;
CEdit m_explain;
CEdit m_ip;
CEdit m_fileopen;
CEdit m_out;
CEdit m_in;
CStatic m_stringadd;
CListCtrl m_list;
CAdodc m_adodc;
CDataGrid m_datagrid;
COleDateTime m_datetime;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVcadoDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CVcadoDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
virtual void OnOK();
afx_msg void OnButton1();
afx_msg void Oninsertdb();
afx_msg void Onexit();
afx_msg void Onfilereform();
afx_msg void Onstringadd();
afx_msg void Onspinsert();
afx_msg void Onoutinput();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VCADODLG_H__98A03206_EDFA_42CD_BB0A_7CB271993230__INCLUDED_)
未完,持续,下次为第三部分
感谢网友的支持!
本文地址:http://com.8s8s.com/it/it406.htm