VC中有通用的检验SQL语句是否正确的方法吗?

chdan 2002-07-22 04:16:45
最好不要通过Execute来检验,速度要快.
...全文
116 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jy98huxhu 2002-09-19
  • 打赏
  • 举报
回复
gz
CharmDream 2002-09-19
  • 打赏
  • 举报
回复
up
workercxm 2002-09-19
  • 打赏
  • 举报
回复
我也想知道!
zhangyilan 2002-09-19
  • 打赏
  • 举报
回复
gz
sdb72 2002-09-19
  • 打赏
  • 举报
回复
好像只有通过执行的方式
aben456 2002-09-19
  • 打赏
  • 举报
回复
好象只能通过执行SQL的方法,EXECUTE没有返回的;建议使用OPEN,如上。
objectman 2002-09-19
  • 打赏
  • 举报
回复
不同的数据库SQL有区别,怎么检验??
qing_li73 2002-09-19
  • 打赏
  • 举报
回复
Quick SQL Pass-Through Queries
The fastest way to work with ODBC data sources is via attached tables. See the article DAO External: Working with External Data Sources. For doing bulk operations, the best, and often fastest, approach is to use an SQL pass-through query. It’s possible to do a quick pass-through query using a recordset and without having to create a querydef, even a temporary one. This is also helpful if you’re converting existing code that uses the DB_SQLPASSTHROUGH option in many places.

DAO’s Connect property for databases normally doesn’t have a value for Microsoft Jet (.MDB) databases. But you can assign an ODBC connect string to the property and use the dbSQLPassthrough option in a recordset. This means you don’t have to open the ODBC data source directly to use SQL pass-through.

For example:

// pdb is a pointer to a CDaoDatabase object
// (an .MDB database)
// Set up the connect string
CString strConnect = "ODBC;DSN=ntstuff;UID=sa;PWD=Fred;APP=App Name;WSID=MyComputer;DATABASE=pubs;TABLE=dbo.authors;";
pdb->SetConnect( strConnect );
// Use SQL pass-through in a recordset
// Set up the SQL and open the recordset
CString strSQL = "whatever";
CDaoRecordset rs( pdb );
try
{
rs.Open( dbOpenSnapshot, strSQL, dbSQLPassThrough );
// ...
}
// ...

dyw 2002-09-19
  • 打赏
  • 举报
回复
最好通过Execute来检验

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧