本文介绍了如何从所选名称中获取ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 总而言之,我是mfc编程的新手,所以请不要介意问题是否过于平庸。 我正在尝试使用他的名字获取会员的身份证。在我使用m_strFilter填充的组合框中选择名称以仅获取活动成员列表。我在CString变量名中得到了所选名称,现在我正在尝试再次使用过滤器来获取MSDN上建议的特定ID,但是我得到一个错误:没有运算符+匹配这些操作数操作数类型是常量char [ ] + CString 请帮助 提前致谢 Lidija 我尝试过: CString名称; 长IDmember; m_combo_members.GetWindowText(name); RMembers-> m_strFilter =Name =+ name; RMembers-> Open(); IDmember = RMembers-> m_IDmember; 解决方案 您可能有一个Unicode版本,您可以使用宽字符串字符串连接: RMembers-> m_strFilter = LName =+ name; 或使用 _T() 宏将常量字符串扩展为ANSI或Unicode,具体取决于构建: RMembers-> m_strFilter = _T(Name =)+名; Hy all, I'm new to mfc programming, so please don't mind if the question is too banal.I'm trying to get to member's ID using his name. The name is selected in combo box that I populated using m_strFilter to get only active member list. I get the selected name in the CString variable name, and now I'm trying to use filter again to get a specific ID as suggested on MSDN but I get an error: no operator "+" matches these operands operand types are constant char[] + CStringPlease helpThanks in advanceLidijaWhat I have tried:CString name;long IDmember;m_combo_members.GetWindowText(name);RMembers->m_strFilter = "Name = " + name;RMembers->Open();IDmember = RMembers->m_IDmember; 解决方案 You probably have a Unicode build where you have use a wide string for string concatenation:RMembers->m_strFilter = L"Name = " + name;or use the _T() macro which expands the constant string to ANSI or Unicode depending on the build:RMembers->m_strFilter = _T("Name = ") + name; 这篇关于如何从所选名称中获取ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-01 08:39