www.pudn.com > 6433624505.rar > Detials.cpp
// Detials.cpp : implementation file
//
#include "stdafx.h"
#include "Browser.h"
#include "Detials.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDetials dialog
CDetials::CDetials(CWnd* pParent /*=NULL*/)
: CDialog(CDetials::IDD, pParent)
{
//{{AFX_DATA_INIT(CDetials)
m_Edit = _T("");
FLAG = FALSE;
//}}AFX_DATA_INIT
}
void CDetials::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDetials)
DDX_Control(pDX, IDOK, m_Tuichu);
DDX_Control(pDX, IDC_REFRESH, m_Refresh);
DDX_Control(pDX, IDC_EXPORTDE, m_Export);
DDX_Control(pDX, IDCANCEL, m_Close);
DDX_Text(pDX, IDC_DETIALSEDIT, m_Edit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDetials, CDialog)
//{{AFX_MSG_MAP(CDetials)
ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
ON_BN_CLICKED(IDC_EXPORTDE, OnExportde)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDetials message handlers
BOOL CDetials::OnInitDialog()
{
CDialog::OnInitDialog();
if(FLAG == FALSE)
{
m_bitmapground.LoadBitmap(IDB_DETIAL);
m_Close.LoadBitmaps(IDB_CLOSEONE,IDB_CLOSETWO);
m_Refresh.LoadBitmaps(IDB_REFRESHONE,IDB_REFRESHTWO);
m_Tuichu.LoadBitmaps(IDB_TUICHUONE,IDB_TUICHUTWO);
m_Export.LoadBitmaps(IDB_EXPONE,IDB_EXPTWO);
FLAG = TRUE;
}
OnRefresh();
this->UpdateData(false);
return TRUE;
}
void CDetials::OnRefresh()
{
CString _sql;
if(select == 0)
{
SetWindowText("触发器信息 ---- "+Choice);
Choice.MakeUpper();
_sql.Format("select * from dba_triggers where TRIGGER_NAME = \'%s\'",Choice);
}
if(select == 1)
{
SetWindowText("存储过程信息 ---- "+Choice);
Choice.MakeUpper();
_sql.Format("select * from dba_procedures where PROCEDURE_NAME = \'%s\'",Choice);
}
if(select == 2)
{
SetWindowText("序列信息 ---- "+Choice);
Choice.MakeUpper();
_sql.Format("select * from dba_sequences where SEQUENCE_NAME = \'%s\'",Choice);
}
_bstr_t sql = _sql;
CString val,name;
counts = 0;
try
{
pRst = pConn->Execute(sql,NULL,adCmdText);
colume = pRst->Fields->GetCount();
for(int a = 0;a < colume;a++)
{
name = (char *)_bstr_t(pRst->Fields->GetItem(long(a))->Name);
names.push_back(name);
}
while(!pRst->End)
{
for(int b = 0;b < colume;b++)
{
_variant_t vValue = pRst->Fields->GetItem(long(b))->Value;
if(vValue.vt == VT_NULL)
val = "NULL";
else
val = (char *)_bstr_t(vValue);
values.push_back(val);
}
counts ++;
pRst->MoveNext();
}
counts = 0;
pRst->Close();
pRst.Release();
}
catch(_com_error &e)
{
AfxMessageBox(e.Description());
}
m_Edit.Empty();
CString str[100];
for(int i = 0;i < names.size(); i++)
{
str[i].Format("%s: %s\r\n\r\n",names[i],values[i]);
m_Edit += str[i];
}
this->UpdateData(false);
names.clear();
values.clear();
}
void CDetials::OnOK()
{
CDialog::OnOK();
}
void CDetials::OnExportde()
{
CFile file(_T("OtherInfor.txt"),CFile::modeWrite | CFile::modeCreate);
file.Write(m_Edit,m_Edit.GetLength());
}
void CDetials::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(&rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
BITMAP bitMap;
m_bitmapground.GetBitmap(&bitMap);
CBitmap *pbmpOld=dcMem.SelectObject(&m_bitmapground);
dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,bitMap.bmWidth,bitMap.bmHeight,SRCCOPY);
CDialog::OnPaint();}
void CDetials::OnLButtonDown(UINT nFlags, CPoint point)
{
if(point.x >=5 && point.x <= 80 && point.y >= 2 && point.y <=35)
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x, point.y));
CDialog::OnLButtonDown(nFlags, point);
}