📄 subject_52715.htm
字号:
<p>
序号:52715 发表者:大就 发表日期:2003-09-13 17:35:47
<br>主题:查询的问题?帮忙改一下!!
<br>内容:void CTaoView::OnIdsearch(){<BR> <BR>CTaoView search;<BR>m_pSet->m_strFilter="m_pSet->m_id==search.m_idsearch";<BR>m_pSet->Requery();<BR>OnInitialUpdate1();<BR>}<BR>我是想做一个查询的。m_pSet->m_id==search.m_idsearch有问题。帮我改一下好吗?谢谢!!!!能给我写一个好吗?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:ShaGua 回复日期:2003-09-13 18:27:03
<br>内容:m_id的对应的字段为id吧.<BR>m_pSet->m_strFilter.Format("id=%s",search.m_idsearch);<BR>其中假设为search.m_idsearch字符串<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大就 回复日期:2003-09-14 00:35:28
<br>内容:楼上的。。再帮帮,,<BR>还是不行。。。我很菜////<BR>他说。(语法错误(操作符丢失)在查询表达式'id='中)<BR>怎样改呀。。。<BR>我的m_pSet->id 对应的字段是id
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大就 回复日期:2003-09-14 01:09:49
<br>内容:我的OnInitialUpdate1();是这样的。。<BR>void CTaoView::OnInitialUpdate1(){<BR> if(m_pSet->GetRecordCount() == 0)<BR> return;<BR> m_theList.DeleteAllItems();<BR> m_pSet->MoveFirst();<BR> while(!m_pSet->IsEOF())<BR> {<BR>CString strXC;<BR>m_theList.InsertItem (m_theList.GetItemCount(),m_pSet->m_id);<BR>m_theList.SetItemText(m_theList.GetItemCount()-1,1,m_pSet->m_name);<BR>m_theList.SetItemText(m_theList.GetItemCount()-1,2,m_pSet->m_sex);<BR>strXC.Format("%8d",m_pSet->m_tel);<BR>m_theList.SetItemText(m_theList.GetItemCount()-1,3,strXC);<BR>m_theList.SetItemText(m_theList.GetItemCount()-1,4,m_pSet->m_address);<BR>strXC.Format("%8d",m_pSet->m_QQ);<BR>m_theList.SetItemText(m_theList.GetItemCount()-1,5,strXC);<BR>m_pSet->MoveNext();<BR> }<BR><BR><BR>}
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ShaGua 回复日期:2003-09-14 09:14:34
<br>内容:前面有错误,应该是:<BR>m_pSet->m_strFilter.Format("id='%s'",search.m_idsearch);<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大就 回复日期:2003-09-14 18:51:00
<br>内容:谢谢你。我试一下,再不行就再来找你。呵呵~~~
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大就 回复日期:2003-09-15 00:29:03
<br>内容:还是不行!那句话已经没有问题了。但是就是查不出来。ShaGua 你能不能帮我写一个呀!!<BR>谢谢了!!内容就是想查询学号为XX的同学。其中。search.m_idsearch,为查询的条件。而数据库的id为字段<BR>多谢~~<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ShaGua 回复日期:2003-09-15 08:07:56
<br>内容:上面的方法是必须输入完整而且正确。<BR>如果是模糊的查询,可以使用:<BR>m_pSet->m_strFilter.Format("id like '%%%s%%'",search.m_idsearch);<BR><BR>最好把处理查询的代码贴出来。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大就 回复日期:2003-09-15 12:43:46
<br>内容:<BR>我的查询代码是这样的:<BR>void CTaoView::OnIdsearch() <BR>{<BR> CTaoView search;<BR>m_pSet->m_strFilter.Format("id='%s'",search.m_idsearch);<BR>m_theList.DeleteAllItems();<BR>m_pSet->Requery();<BR><BR>if(m_pSet->IsEOF())<BR> { <BR> AfxMessageBox("没有符合条件的记录");<BR> }<BR> else<BR> OnInitialUpdate1();<BR><BR> <BR>}<BR>2003-9-15 21:50:39
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -