本文介绍了如何在mfc中运行sql命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行查询

StateName的数据类型是ms中的文本访问2000

I want to run query
datatype of StateName is text in ms access 2000

CString cmd,statename;
m_CurrentStateCOMBO.GetWindowTextA(statename);
cmd.Format("select StateID from State where StateName=%s",statename);
m_recordset.Open(AFX_DAO_USE_DEFAULT_TYPE,cmd,CRecordset::forwardOnly);





警告参数太少。预期1



如何跟随线路工作



warining is too few parameters. expected.1

how ever following line is working

datatype of StateID is number in ms access 2000
int sateid=3;
cmd.Format("select CityName from City where StateID=%d",sateid);
	m_recordset.Open(AFX_DAO_USE_DEFAULT_TYPE,cmd,CRecordset::forwardOnly);

推荐答案


cmd.Format("select StateID from State where StateName='"+statename+"'");


这篇关于如何在mfc中运行sql命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 08:44