12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- // SqlDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "SqlDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SqlDlg dialog
- SqlDlg::SqlDlg(CWnd* pParent /*=NULL*/)
- : CDialog(SqlDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SqlDlg)
- m_sql = _T("");
- //}}AFX_DATA_INIT
- }
- void SqlDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SqlDlg)
- DDX_Text(pDX, IDC_EDIT1, m_sql);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SqlDlg, CDialog)
- //{{AFX_MSG_MAP(SqlDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SqlDlg message handlers
- extern BOOL MyExecuteSQL(CDatabase *pdb, CString sql);
- void SqlDlg::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- MyExecuteSQL(&g_db, m_sql);
- if(m_sql.GetLength ()<6)return;
- if(m_sql.Left (6)!="select")return;
- int i;CString temp,str;
- int colcount;
- CODBCFieldInfo fieldinfo;
- CRecordset myset(&g_db);
- myset.Open (CRecordset::forwardOnly, m_sql);
- while(!myset.IsEOF ())
- {
- colcount=myset.GetODBCFieldCount ();
- for( i=0; i<colcount; i++)
- {
- myset.GetFieldValue(i, temp);
- str+="'"+temp+"',";
- }
- str.TrimRight (",");
- str+="\r\n";
- myset.MoveNext ();
- }
- myset.Close();
- AfxMessageBox(str);
- }
- BOOL SqlDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- GetDlgItem(IDC_EDIT1)->SetFocus();
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
|