求一ADO中的SQL命令 简单的小问题
怎样取得一个数据集要ID>一个值
m_pRecordset1->Open(“SELECT * FROM Data” , // 查询DemoTable表中所有字段
theApp.m_pTreeConn.GetInterfacePtr(), // 获取库接库的IDispatch指针
adOpenDynamic,
adLockOptimistic,
adCmdText);
取所有是如上
我改成下面的就有问题 请问该怎么处理 要是去一个区间是否SQL写成
SELECT * FROM Data where ID>***AND ID<***
CString strSQL="";
strSQL="SELECT * FROM Data where ID> "+count*512 ;
_RecordsetPtr m_pRecordset1;
m_pRecordset1.CreateInstance(__uuidof(Recordset));
try
{
m_pRecordset1->Open(strSQL, // 查询DemoTable表中所有字段
theApp.m_pTreeConn.GetInterfacePtr(), // 获取库接库的IDispatch指针
adOpenDynamic,
adLockOptimistic,
adCmdText);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}