`

dbcmd

阅读更多

dbcmd

Adds text to the DBPROCESS command buffer.

Syntax

RETCODE dbcmd ( 
PDBPROCESS 
dbproc
LPCSTR 
cmdstring );

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.

cmdstring

Is a null-terminated character string to be copied into the command buffer.

Returns

SUCCEED or FAIL.

Remarks

This function adds text to the command buffer in the DBPROCESS structure. It adds to the existing command buffer; it doesn't delete or overwrite the current contents except after the buffer has been sent to SQL Server. The user can calldbcmd repeatedly. Note that sequential calls are concatenated; the application must include any necessary blanks between the end of one line and the beginning of the next.

After a call to dbsqlexec or dbsqlsend, the first call to either dbcmd or dbfcmd automatically clears the command buffer before the new text is entered. If this situation is undesirable, set the DBNOAUTOFREE option. When DBNOAUTOFREE is set, the command buffer is cleared only by a call to dbfreebuf.

The dbfcmd function is a related function. Unlike dbcmddbfcmd takes additional parameters and interprets cmdstringas a format string that is passed to sprintf along with any additional parameters.

Examples

This example shows how to use dbcmd to build up a multiple-line SQL statement:

DBPROCESS   *dbproc;

dbcmd(dbproc, "SELECT name FROM sysobjects");
dbcmd(dbproc, " WHERE id < 5");
dbcmd(dbproc, " AND type='S'");

Note the leading spaces in the second and third calls to dbcmd. Leading spaces are needed to properly concatenate the entire command string.

 

See Also

Bulk-Copy Functions

dbsetopt

dbfcmd

dbsqlexec

dbfreebuf

dbsqlsend

DB-Library Options

分享到:
评论

相关推荐

    Unity3D教程:Unity3D与Sqlite数据库直连1

    然后,通过`connection`字符串创建`IDbConnection`对象`dbcon`,接着创建`IDbCommand`对象`dbcmd`,并用它来执行SQL命令。 执行SQL命令通常包括以下步骤: 1. 创建`IDbCommand`对象,并设置其`CommandText`属性为...

    Unity使用JavaScript访问SQLite本地数据库1

    dbcmd = dbcon.CreateCommand(); dbcmd.CommandText = q; reader = dbcmd.ExecuteReader(); if(r){ return reader; } } ``` 其中,BasicQuery 函数用于执行 SQL 命令,q 参数为 SQL 命令,r 参数为是否...

    电子商务网站建设及管理复习.doc

    dbcmd.mandtext = "Select xh, xm, mz from xsxx where mz&lt;&gt;'汉族'" set rs = dbcmd.execute %&gt; 学号 姓名 民族 &lt;td&gt;&lt;%=rs("xh")%&gt; &lt;td&gt;&lt;%=rs("xm")%&gt; &lt;td&gt;&lt;%=rs("mz")%&gt; set rs = nothing set...

    Java解析SQL的基本思路.pdf

    cmdMap是一个HashMap,用于将SQL关键字与对应的DBCmd对象进行映射。Parser类的构造函数用于初始化Parser对象,接受一个SQL语句作为参数,并根据第一个SQL关键字确定要执行的数据库命令。 在Parser类中,我们可以...

    DB-Libray 编程(SQL Server).rar_DB Library _DB_library_VC SQL Ser

    通过在VC项目中包含DB-Library头文件和链接库,可以调用其提供的API函数,如`dbopen`、`dbcmd`、`dbexec`等来连接数据库、发送SQL命令及处理返回的结果。 3. **编程步骤** - **连接数据库**:首先,需要使用`db...

    db_lib_test.rar_ DB-LIB _DB li

    执行SQL语句通常是通过`dbcmd()`和`dbexec()`完成的,`dbcmd()`设置SQL命令,而`dbexec()`则执行该命令。处理结果集可以通过`dbresults()`和`dbfetch()`等函数来实现,这些函数允许遍历和获取查询结果中的每一行数据...

    DataGridView修改后直接保存到数据库实例程序

    C#中DataGridView修改后直接保存到数据库... if (dbo.DBcmd&#40;sqlcmd&#41;) { resultshow.Text = " 编辑成功"; } else { resultshow.Text = " 编辑失败"; } } catch { MessageBox.Show("异常", "错误"); } }

    linux下freetds连接SQLserver2005的经典例子

    `dbcmd()`用于设置要执行的SQL语句,这里是一个简单的`SELECT`语句。`dbexec()`执行SQL,如果成功或有更多结果,`dbresults()`将检查结果集。通过`dbnextrow()`遍历所有结果行,并进行相应的处理。 最后,`dbclose...

    DB-Library For C 的封装

    7. **存储过程调用**:通过`dbproc()`函数可以调用存储过程,通常需要先`dbcmd()`设置存储过程名称,然后传递参数。 8. **连接池**:虽然DB-Library本身不直接支持连接池,但开发者可以自行实现,以优化多个并发...

    20120330_Linux下用freetds执行SqlServer的sql语句和存储过程1

    dbcmd(dbprocess,strSql); if(dbsqlexec(dbprocess) == FAIL){ printf("Query error.\n"); return false; } DBINT result_code; char infArr[MaxColumnNums][MaxColumnSize]; int retCode = 1; while (...

    VC++ 中使用 DB-Libray 编程

    例如,执行SELECT查询时,可以用`dbcmd()`指定SQL语句,`dbexec()`执行后,通过`dbsqlok()`检查是否成功,再用`dbresults()`检查是否有结果集。 4. **结果集处理**:`dbnextrow()`用于获取结果集中下一行数据,`...

    封装DB—Library函数实现VC对SQL Server的快速访问.pdf

    例如,`dbopen()`用于建立连接,`dbcmd()`用于设置SQL命令,`dbresults()`用于处理查询结果,`dbgetchar()`用于读取结果集中的数据。 2. **创建类结构**:基于这些函数,设计一个或多个C++类,将API功能映射到类的...

    db_library.rar_DB-Library_DB_library_db_library sqlserver_sqlser

    3. `dbcmd()`: 准备SQL命令,如SELECT、INSERT、UPDATE或DELETE语句。 4. `dbcancel()`: 取消当前执行的SQL命令,用于处理错误或中断操作。 5. `dbexec()`: 执行已准备的SQL命令。 6. `dbresults()`: 检查查询结果,...

    PhManage_until1m6_Vc_

    3. **执行SQL命令**:使用`dbcmd()`函数设定要执行的SQL命令,如SELECT、INSERT、UPDATE或DELETE。然后通过`dbcursor()`开启一个新的游标,以处理查询结果。 4. **处理结果集**:使用`dbfetch()`函数遍历结果集,...

    Sybase OpenClient 编程小资料

    `dbcmd()` 函数用于设置 SQL 命令,而 `dbexecute()` 或 `dbSend()` 用于执行命令。 3. **游标处理**:OpenClient 提供了游标支持,允许应用程序逐行处理查询结果。通过 `dbsetlfetch()` 和 `dbgetrow()` 等函数,...

    利用块拷贝技术进行数据库恢复的一种方法 (1999年)

    其次,在进行数据库恢复过程中,应使用dbcmd函数将存储过程的“bulk”参数设置为“true”。第三,如果dbsqlexec函数调用失败,通常是由于格式错误,因此在编写时应特别小心。最后,对于每一个批处理命令或存储过程...

Global site tag (gtag.js) - Google Analytics