hi
I am trying to put image into database using SQLPutData.The function is returning SQL_SUCCESS.However I cannot retrieve image data using SQLGetData.These functions however work properly for normal character and integer datatypes.On using SQLGetData it returns SQL_ERROR and on using SQLDiagRec it returns SQL_NO_DATA. Plz help me out!!!



SQLBindParameter(hstmt,1,SQL_PARAM_INPUT,SQL_C_BIN
ARY,SQL_LONGVARBINARY,lbytes,0,(void *)1,0,&cbTextSize);
//lbytes=TEXTSIZE;
retcode = SQLExecDirect(hstmt,
"insert into puti values(?)",
SQL_NTS);
if(retcode==SQL_NEED_DATA)
MessageBox(NULL,"sofarsogood",NULL,MB_OK);
retcode = SQLParamData(hstmt, &pParmID);
lbytes=10;
if(retcode==SQL_NEED_DATA)
{

while(lbytes<FileSize)
{

mm=ReadFile(hfile,Data,lbytes, &BytesRead, NULL);
if(mm==0&&BytesRead==0&&flag==TRUE)
{
MessageBox(NULL,"read err","err",MB_OK);
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);



retcode = SQLExecDirect(hstmt,
"SELECT pic FROM puti",
SQL_NTS);
retcode = SQLFetch(hstmt);
SQLGetData(hstmt, 1, SQL_C_CHAR, szName, NAME_LEN, &cbName);