| 4D v18ODBC_SQLPutData | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D v18
 ODBC_SQLPutData 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ODBC_SQLPutData ( stmtID ; valuePtr ; strLenOrInd ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| stmtID | Longint |   | Statement ID | |||||
| valuePtr | Pointer |   | Pointer to the actual data for the parameter or column | |||||
| strLenOrInd | Longint |   | Amount of data to send | |||||
| Function result | Longint |   | Returns the result of the MS ODBC API function SQLPutData | |||||
The ODBC_SQLPutData command sends data for a parameter or column to the driver at statement execution time.
stmtID is a valid statement ID returned by ODBC_SQLAllocStmt.
valuePtr is a pointer to the data for the parameter or column.
strLenOrInd is an optional parameter that defines the amount of data to send if paramType is of type Text, Picture, or BLOB. Use the ODBC_LenDataAtExec command to convert the actual length so that it can be processed by the MS ODBC API.
For more information, please see the SQLPutData function in the MS ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms713824(VS.85).aspx.
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
The following method creates a bind with our data source's Employee table and inserts data into its four fields. If ODBC_SQLPrepare command returns SQL_NEED_DATA, we find out which parameter need data by calling ODBC_SQLParamData and insert a value using ODBC_SQLPutData:
 vIndic:=ODBC_LenDataAtExec(5)
 $result:=ODBC_SQLPrepare($statementID;"INSERT INTO Employee (ID, Name, Hire_Date, Current_Employee) VALUES (?, ?, ?, ?)")
 
 vEmployeeHireDate:=Current date
 vEmployeeID:=6
 vEmployeeFullname:=""
 vEmployeeCurrent:=True
 
 $result:=ODBC_SQLBindParameter($statementID;1;1;SQL_SMALLINT;0;0;->vEmployeeID)
 $result:=ODBC_SQLBindParameter($statementID;2;1;SQL_CHAR;10;0;->vEmployeeFullname;->vIndic)
 $result:=ODBC_SQLBindParameter($statementID;3;1;SQL_TYPE_DATE;0;0;->vEmployeeHireDate)
 $result:=ODBC_SQLBindParameter($statementID;4;1;SQL_BIT;0;0;->vEmployeeCurrent)
 
 $result:=ODBC_SQLExecute($statementID)
 While($result=SQL_NEED_DATA)
    $result:=ODBC_SQLParamData($statementID;vWhichField) //Returns a pointer to the expected parameter
    vWhichField->:="More data needed"
    $result:=ODBC_SQLPutData($statementID;vWhichField)
 End while
	Product:  4D
	Theme:  ODBC_Submit requests
	Number:  
        16966
        
        
        
	
	Created:  4D ODBC Pro 2004
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D ODBC Pro ( 4D v18)
	
	
 Add a comment
Add a comment