CDatabase::ExecuteSQL()

CDatabase::ExecuteSQL()CDatabase::ExecuteSQLCallthismemberfunctionwhenyouneedtoexecuteaSQLcommanddirectly.当你要直接执行SQL命令的时候就访问这个成员函数voidExecuteSQL(  LPCTSTRlpszSQL );lpszSQLPointertoanull

大家好,又见面了,我是你们的朋友全栈君。

CDatabase::ExecuteSQL

Call this member function whenyou need to execute a SQL command directly.

当你要直接执行SQL命令的时候就访问这个成员函数

void ExecuteSQL(

  LPCTSTR lpszSQL 

);


lpszSQL

Pointer to anull-terminated string containing a valid SQL command to execute. You can passa CString.

一个指向以null结尾的string指针,string字符串包含一个可执行SQL命令。你可以直接传递一个Cstring

Remarks


Create the commandas a null-terminated string. ExecuteSQL does not return data records. Ifyou want to operate on records, use a recordset object instead.

将命令创建长null-terminated结尾的string。函数不返回数据集。如果你想操作数据集,请改用recordset对象。

Most of yourcommands for a data source are issued through recordset objects, which supportcommands for selecting data, inserting new records, deleting records, andediting records. However, not all ODBC functionality is directly supported bythe database classes, so you may at times need to make a direct SQL call with ExecuteSQL.

大多数关于数据源的命令是通过recordset对象发布的,它支持选择数据源,插入新的记录,删除记录以及编辑记录。然而,并不是所有的ODBC功能都被database类直接支持,所以有时候你需要用ExecuteSQL成员函数来直接访问SQL。

Example


try

  {

     m_dbCust.ExecuteSQL(

        _T(“UPDATE Taxes”)

           _T(“SET Rate =’36’ “)

           _T(“WHERE Name= ‘Federal'”));

  }

  catch(CDBException* pe)

  {

     // The error code isin pe->m_nRetCode

 

     pe->ReportError();

     pe->Delete();

  }

 

 

try

{

  m_dbCust.ExecuteSQL(

     _T(“UPDATE Taxes “)

        _T(“SET Rate = ’36’ “)

         _T(“WHERE Name = ‘Federal'”));

}

catch(CDBException* pe)

{

   //The error code is in pe->m_nRetCode

  pe->ReportError();

  pe->Delete();

}

 

Requirements


Header: afxdb.h

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/143454.html原文链接:https://javaforall.net

(0)
上一篇 2022年5月21日 下午5:00
下一篇 2022年5月21日 下午5:00


相关推荐

  • 高效 Agents 构建指南

    高效 Agents 构建指南

    2026年3月15日
    3
  • java水仙花数的代码如下及其讲解。

    java水仙花数的代码如下及其讲解。publicclassF publicstatic String args for inti 100 i lt 1000 i inth i 100 intt i 100 10 ints i 10 if h h h t t t s s s i

    2026年3月17日
    2
  • MySQL安装Altas

    MySQL安装Altas准备工作 需要先把 MySQL 主从配置好 0 下载 altas 打开 https github com Qihoo360 Atlas releaseswget github com Qihoo360 Atlas releases download 2 2 1 Atlas 2 2 1 el6 x86 64 rpm1 安装 altasrpm ivhAtlas

    2026年3月19日
    2
  • mysql分区表_MySQL分区分表[通俗易懂]

    mysql分区表_MySQL分区分表[通俗易懂]1、为什么要分表?数据库数据越来越大,随之而来的是单个表中数据太多。以至于查询速度变慢,而且由于表的锁机制导致应用操作也搜到严重影响,出现了数据库性能瓶颈。mysql中有一种机制是表锁定和行锁定,是为了保证数据的完整性。表锁定表示你们都不能对这张表进行操作,必须等我对表操作完才行。行锁定也一样,别的sql必须等我对这条数据操作完了,才能对这条数据进行操作。当出现这种情况时,我们可以考虑分表或分区。…

    2022年4月29日
    53
  • 兼容性测试说明

    兼容性测试说明版本说明版本 作者 时间 备注 1 0 冷冷 2019 5 24 首版本提交目录 1 概述 12 缩略词 13 已知问题和注意点 14 兼容性测试定义 15 兼容性测试目的 16 兼容性测试的作用 27APP 兼容性测试 27 1 手机系统 27 2 手机品牌 27 3 分辨率 27 4 运营商 27 5 网络 27 6

    2025年12月5日
    6
  • 二进制中补码计算简单详实的讲解

    二进制中补码计算简单详实的讲解首先说明一点这篇博文是基于网络资料写作而来 尊重知识 广泛传播 可能你就需要它 但是转载请注明出处本博文参考链接参考资料参考资料本文说明一个基本的问题 补码的问题 负数在计算机中如何表示 举例来说 8 在计算机中表示为二进制的 1000 那么 8 怎么表示呢 很容易想到 可以将一个二进制位 bit 专门规定为符号位 它等于 0 时就表示正数 等于 1 时就表示负数 比如 在 8 位机中 规定每个字节的

    2026年3月26日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号