//邮件
CEmail_webSet Email_web ;
CString strSQL;
strSQL="select * from Email_web";
if(!Email_web.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
{
MessageBox("打开数据库失败!","数据库错误",MB_OK);
}
while(!Email_web.IsEOF())
{
ctr_Email.AddString(Email_web.m_Website);
Email_web.MoveNext();
}
Email_web.Close();
ctr_Email.SetCurSel (0);
//省市 order by Serial_num desc
CProvince_citySet Province_city ;
CString strSQL2;
strSQL2="select Province from Province_city group by Province order by min(Serial_num)";
if(!Province_city.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL2)) // 用断点调试后,执行此语句就会有 造型说明无效的字符值 的错误,但是 前面一样的语句为什么不出现。这个该怎么修改?SQL语句是没有问题的,在查询器里试过了,而且换成简单的语句也一样是这个错误
{
MessageBox("打开数据库失败!","数据库错误",MB_OK);
}
while(!Province_city .IsEOF())
{
ctr_Province.AddString(Province_city.m_Province);
Province_city .MoveNext();
}
Province_city.Close();
ctr_Province.SetCurSel(0);
------解决方案--------------------
- SQL code
select distinct Province from Province_city