bcp_sendrow

Sends a row of data from program variables to SQL Server.

Syntax

RETCODE bcp_sendrow ( PDBPROCESS dbproc );

where

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

Returns

SUCCEED or FAIL.

Remarks

The bcp_sendrow function builds a row from program variables and sends it to SQL Server.

Before calling bcp_sendrow, you must make calls to bcp_bind to specify the program variables to be used.

If bcp_bind is called with a type parameter of SQLTEXT or SQLIMAGE and a non-null varaddr parameter, bcp_sendrow sends the entire text or image data value, just as it does for all other datatypes. If, however, bcp_bind has a null varaddr parameter, bcp_sendrow returns control to the application immediately after all nontext and nonimage columns are sent to SQL Server. The application can then call bcp_moretext repeatedly to send the text and image columns to SQL Server, a chunk at a time. For an example, see bcp_moretext.

After the last call to bcp_sendrow, you must call bcp_done to ensure proper internal cleanup.

When bcp_sendrow is used to bulk copy rows from program variables into SQL Server tables, rows are permanently saved in SQL Server only when the user calls bcp_batch or bcp_done. The user can choose to call bcp_batch once every n rows or when there is a lull between periods of incoming data. Of course, the user can choose some other criteria or decide not to call bcp_batch at all. If bcp_batch is never called, the rows are permanently saved in SQL Server when bcp_done is called.

See Also

bcp_batch, bcp_bind, bcp_colfmt, bcp_collen, bcp_colptr, bcp_columns, bcp_control, bcp_done, bcp_exec, bcp_init, bcp_moretext