Dlg_ReadDB.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Dlg_ReadDB.cpp : 实现文件
  2. //
  3. #include "stdafx.h"
  4. #include "SupportSmsPlatform.h"
  5. #include "Dlg_ReadDB.h"
  6. #include ".\dlg_readdb.h"
  7. // CDlg_ReadDB 对话框
  8. IMPLEMENT_DYNAMIC(CDlg_ReadDB, CDialog)
  9. CDlg_ReadDB::CDlg_ReadDB(CWnd* pParent /*=NULL*/)
  10. : CDialog(CDlg_ReadDB::IDD, pParent)
  11. , m_sComb_DBType(_T(""))
  12. , m_sEdit_DBIP(_T(""))
  13. , m_sEdit_DBName(_T(""))
  14. , m_sEdit_DBUser(_T(""))
  15. , m_sEdit_DBPwd(_T(""))
  16. , m_sEdit_SQL(_T(""))
  17. {
  18. }
  19. CDlg_ReadDB::~CDlg_ReadDB()
  20. {
  21. }
  22. void CDlg_ReadDB::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. DDX_Control(pDX, IDC_COMBO_DBTYEP, m_Comb_DBType);
  26. DDX_CBString(pDX, IDC_COMBO_DBTYEP, m_sComb_DBType);
  27. DDX_Text(pDX, IDC_EDIT_DBIP, m_sEdit_DBIP);
  28. DDX_Text(pDX, IDC_EDIT_DBNAME, m_sEdit_DBName);
  29. DDX_Text(pDX, IDC_EDIT_DBUSER, m_sEdit_DBUser);
  30. DDX_Text(pDX, IDC_EDIT_DBPWD, m_sEdit_DBPwd);
  31. DDX_Text(pDX, IDC_EDIT_CONTENT, m_sEdit_SQL);
  32. }
  33. BEGIN_MESSAGE_MAP(CDlg_ReadDB, CDialog)
  34. END_MESSAGE_MAP()
  35. // CDlg_ReadDB 消息处理程序
  36. BOOL CDlg_ReadDB::OnInitDialog()
  37. {
  38. CDialog::OnInitDialog();
  39. // TODO: 在此添加额外的初始化
  40. GetIni();
  41. return TRUE; // return TRUE unless you set the focus to a control
  42. // 异常: OCX 属性页应返回 FALSE
  43. }
  44. void CDlg_ReadDB::GetIni()
  45. {
  46. g_IniFile.GetVarStr( "Database_RomoteDB","ServerName",m_sEdit_DBIP );
  47. g_IniFile.GetVarStr( "Database_RomoteDB","DataBaseName",m_sEdit_DBName );
  48. g_IniFile.GetVarStr( "Database_RomoteDB","UserName",m_sEdit_DBUser );
  49. g_IniFile.GetVarStr( "Database_RomoteDB","Password",m_sEdit_DBPwd );
  50. g_IniFile.GetVarStr( "Database_RomoteDB","DBType",m_sComb_DBType );
  51. m_sEdit_SQL = "t_waring_record \r\n"\
  52. "( \r\n"\
  53. "id, //序列号【整型】不能为空\r\n"\
  54. "equip_desc, //设备描述【字符串】\r\n"\
  55. "type_desc, //类型描述【字符串】\r\n"\
  56. "happen_time, //报警时间【时间类型】\r\n"\
  57. "curr_status, //当前状态【整型】】\r\n"\
  58. "curr_value, //当前值【浮点型】\r\n"\
  59. "memos, //备注【字符串】\r\n"\
  60. "warncontent //报警内容【字符串】\r\n"\
  61. ") ";
  62. UpdateData( false );
  63. }
  64. void CDlg_ReadDB::SetIni()
  65. {
  66. g_IniFile.SetVarStr( "Database_RomoteDB","ServerName",m_sEdit_DBIP );
  67. g_IniFile.SetVarStr( "Database_RomoteDB","DataBaseName",m_sEdit_DBName );
  68. g_IniFile.SetVarStr( "Database_RomoteDB","UserName",m_sEdit_DBUser );
  69. g_IniFile.SetVarStr( "Database_RomoteDB","Password",m_sEdit_DBPwd );
  70. g_IniFile.SetVarStr( "Database_RomoteDB","DBType",m_sComb_DBType );
  71. }
  72. void CDlg_ReadDB::Apply()
  73. {
  74. }