2 u011415588 u011415588 于 2013.07.15 22:49 提问

VC6.0 MFC两个对话框之间的数据通信

做的一个成绩查询系统,想实现先登录,再查询
我在第一个对话框中输入学号,密码,登陆成功
UpdateData(true);
variant_t var;
CString strName = "";
_ConnectionPtr m_pConnection;
_CommandPtr m_pCommand;
_RecordsetPtr m_pRecordset;
CString SQL;
char*STRSQL;
SQL="SELECT * FROM studentinfo WHERE num='"+m_num+"' and pwd='"+m_pwd+"'";
STRSQL=SQL.GetBuffer(SQL.GetLength());
::CoInitialize(NULL);
m_pConnection.CreateInstance(
_uuidof(Connection));
try

{

m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb","","",adModeUnknown);
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->Open(STRSQL,

m_pConnection.GetInterfacePtr(), // 获取库接库的IDispatch指针
adOpenDynamic,
adLockOptimistic,
adCmdText);

连上了数据库,怎样在第三个对话框里来显示刚刚登陆的时候连上的数据库里的信息?

m_List.DeleteAllItems();
UpdateData(TRUE);
_variant_t var;
CString strName = "";
_ConnectionPtr  m_pConnection;
_CommandPtr     m_pCommand;
_RecordsetPtr   m_pRecordset;
CString SQL;
char*STRSQL;
 ** */*CYyyDlg  rt;
m_NUM=rt.m_num;
UpdateData(false);*/* ** 我本来想这样来实现,把m_num的值赋给m_NUM,但是没用


SQL="SELECT * FROM studentinfo WHERE num='"+m_NUM+"'";
STRSQL=SQL.GetBuffer(SQL.GetLength());
::CoInitialize(NULL);
m_pConnection.CreateInstance(__uuidof(Connection));
try                 
{   
    m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb","","",adModeUnknown);

1个回答

xobeyond
xobeyond   2015.05.06 09:05

C052012099

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!