But I'm FROM the statement and there is no problem, I found two abnormal debugging carefully for a moment,
Error: ODBC failure on SQLPrepare or SQLExecDirect
TS. Exe of 0 x75695b68 place the most possible exceptions: Microsoft c + + exceptions: memory location 0 x0050e234 CDBException,
TS. Exe of 0 x75695b68 place the most possible exceptions: Microsoft c + + exceptions: memory location 0 x00000000 [rethrow],
I just want to know what happened,
O great god answers,
CodePudding user response:
# include "stdafx. H"
# include "TS. H"
# include "usersDlg. H"
# include "afxdialogex. H"
# include "toaccess. H"
//usersDlg dialog
IMPLEMENT_DYNAMIC (usersDlg CDialogEx)
UsersDlg: : usersDlg (pParent/*=NULL CWnd * */)
: CDialogEx (usersDlg: : IDD, pParent)
{
}
UsersDlg: : ~ usersDlg ()
{
}
Void usersDlg: : ListAll cstrings (STR)
{
M_list. DeleteAllItems ();
Ctoaccess m_access;
Try
{
If (m_access IsOpen ())
M_access. Close ();
if(! M_access. Open (CRecordset: : the snapshot, STR))
{
MessageBox (L open the database "failure", MB_OK);
return;
}
}
The catch (CDBException * e)
{
E - & gt; ReportError ();
}
Int nindex=0;
M_access. MoveFirst ();
Cstrings ususername uspassword;
while(! M_access. IsEOF ())
{
LV_ITEM litem;
Litem. Mask=LVIF_TEXT;
Litem. IItem=nindex;
Litem. ISubItem=0;
Litem. PszText=L "";
M_list. InsertItem (& amp; Litem);
M_list. SetItemText (nindex. Zero, m_access m_username);
M_list. SetItemText (nindex, 1, m_access m_password);
M_access. MoveNext ();
Nindex++;
}
M_access. Close ();
}
BOOL usersDlg: : OnInitDialog ()
{
Ctoaccess m_set;
M_set. The Open ();
M_set. MoveFirst ();
DWORD
DwExStyle=LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE;
M_list. SetExtendedStyle (dwExStyle);
M_list. SetTextColor (RGB (0, 255));
M_list. SetBkColor (RGB (240247233));
M_list. InsertColumn (0, L "user name", LVCFMT_CENTER, 65, 0).
M_list. InsertColumn (" password ", 1, L LVCFMT_CENTER, 65, 0).
Cstrings TRSQL;
TRSQL. The Format (L "select * FROM [toaccess]");
ListAll (TRSQL);
return TRUE;
}
Void usersDlg: : DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
}
BEGIN_MESSAGE_MAP (usersDlg CDialogEx)
END_MESSAGE_MAP ()
//usersDlg message handler
CodePudding user response:
Try TRSQL. The Format (L "select * FROM toaccess");CodePudding user response: