目的是将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_)
未完,持续,下次为第三部分
感谢网友的支持!