vc6.0如何查询sql数据库
vc6.0怎么查询sql数据库?

这是链接数据库后查询的一段代码。
m_look是CString类型的,
主要是不知道 bstrSQL ="select*from own where name=:a"; //设置查询语句
这一句该怎么写
这样写会提示:附近有语法错误。
改成 bstrSQL ="select*from own where name='%s' ",a; //设置查询语句
后,查不出内容
如果直接写 bstrSQL ="select*from own where name='可口可乐' "; //设置查询语句
是可以查出内容的。(假设表中name有可口可乐这一项)
谢谢大家啦
------解决思路----------------------
bstrSQL ="select*from own where name='%s' ",a
改成
bstrSQL.Format("select * from own where name='%s' ",a);
------解决思路----------------------
bstrSQL.Format("select * from own where name='%s' ",a);
这是链接数据库后查询的一段代码。
m_look是CString类型的,
主要是不知道 bstrSQL ="select*from own where name=:a"; //设置查询语句
这一句该怎么写
这样写会提示:附近有语法错误。
改成 bstrSQL ="select*from own where name='%s' ",a; //设置查询语句
后,查不出内容
如果直接写 bstrSQL ="select*from own where name='可口可乐' "; //设置查询语句
是可以查出内容的。(假设表中name有可口可乐这一项)
谢谢大家啦
------解决思路----------------------
bstrSQL ="select*from own where name='%s' ",a
改成
bstrSQL.Format("select * from own where name='%s' ",a);
------解决思路----------------------
bstrSQL.Format("select * from own where name='%s' ",a);