用VC和ADO连接如何用sql语句的问题.
VC++ 6.0; SQL 2000; 程序用ADO方式连接;
连接代码如下:
if(FAILED(CoInitialize(NULL))) return FALSE;
_bstr_t strCnn("Provider=sqloledb;Data Source=;Integrated
Security='SSPI';Initial Catalog=psgs;User Id=;Password=;");
// Open recordset from Authors table.
g_pRS.CreateInstance(__uuidof(Recordset));
g_pRS->CursorType = adOpenStatic;
// Use client cursor to enable AbsolutePosition property.
g_pRS->CursorLocation = adUseClient;
g_pRS->Open("usertable", strCnn, adOpenKeyset, adLockBatchOptimistic, adCmdTable);
//usertable
return TRUE;
所有连接都是成功的.现在假设usertable有一条我要找的记录;其中有个字段(名字)的值是"pingshan"; 那么在SQL中的语句为:
"select * from usertable where by 名字='pingshan'" ;
可我弄不懂;"select * from usertable where by 名字='pingshan'" 该怎么发送到SQL数据库让它运行或者说该怎么调用?哎,这问题问得不清楚,请谅解..你们知道我想问什么了吗?就是如何在VC中实现查找数据库中的特定记录? 高手们多多支持解答啊.分数50分,不算高,如果不够请说明,解决问题后我另开帖给分!