Click here to Skip to main content
15,917,538 members
Home / Discussions / Database
   

Database

 
GeneralRe: Database Connections in Sleeping State in SQL Pin
Anonymous8-Oct-03 23:55
Anonymous8-Oct-03 23:55 
GeneralGeneral Network Error Pin
yyf6-Oct-03 7:54
yyf6-Oct-03 7:54 
GeneralRe: General Network Error Pin
Mike Ellison6-Oct-03 17:46
Mike Ellison6-Oct-03 17:46 
GeneralRDBMS Pin
buggy846-Oct-03 4:11
buggy846-Oct-03 4:11 
GeneralRe: RDBMS Pin
Mike Dimmick6-Oct-03 4:26
Mike Dimmick6-Oct-03 4:26 
GeneralSQL/C# Pin
Harry20005-Oct-03 12:09
Harry20005-Oct-03 12:09 
GeneralRe: SQL/C# Pin
Mike Dimmick6-Oct-03 4:33
Mike Dimmick6-Oct-03 4:33 
GeneralSQLBindParameter error Pin
vishnusharma5-Oct-03 1:04
vishnusharma5-Oct-03 1:04 
Well, I am new to C++. For past some time I have been facing a problem.
I have a stored procedure residing on the IBM DB2 database v 7.2.
This stored procedure has one input parameter and two output parameters. All these three parameters are of type datetime.
Whenever I call SQLBindParameter function, the return code is -1. I am unable to figure out why.
Will be grateful to anyone who can show me the right path. Here is the code snippet:
-----------------------------------------------------------------------
SQLHANDLE hStmt = NULL;
DATE_STRUCT dsCurDate,dsIPEffDate,dsPrExpDate;
SQLINTEGER cbDate = 0;

if(!OpenConnection(MakeConnectionString())) return FALSE;

SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_STMT,m_pDatabase->m_hdbc,&hStmt);
if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
return FALSE;
}

ret = SQLPrepare(hStmt,(SQLCHAR*)"CALL BSCPROC.PCI040(?,?,?)",SQL_NTS);
if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
return FALSE;
}

//Input parameter
ret=
SQLBindParameter(hStmt , //Statement handle
1 , //Parameter number
SQL_PARAM_INPUT, //Parameter direction
SQL_C_TYPE_DATE, //SQL C-datatype
SQL_TYPE_DATE , //SQL datatype
0 , //size
0 , //Decimal digits
&dsCurDate , //The input data
0 , //Input data length
&cbDate);
if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
return FALSE;
}

//First output parameter

ret=
SQLBindParameter(hStmt , //Statement handle
2 , //Parameter number
SQL_PARAM_OUTPUT , //Parameter direction
SQL_C_TYPE_DATE , //SQL C-datatype
SQL_TYPE_DATE , //SQL datatype
0 , //size
0 , //Decimal digits
&dsIPEffDate , //The input data
0 , //Input data length
&cbDate);
if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
return FALSE;
}

//Second output parameter
ret=
SQLBindParameter(hStmt , //Statement handle
3 , //Parameter number
SQL_PARAM_OUTPUT , //Parameter direction
SQL_C_TYPE_DATE , //SQL C-datatype
SQL_TYPE_DATE , //SQL datatype
0 , //size
0 , //Decimal digits
&dsPrExpDate , //The input data
0 , //Input data length
&cbDate);

if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
return FALSE;
}

//Specify input parameter
dsCurDate.year = 2003;
dsCurDate.month= 10;
dsCurDate.day = 5;

ret = SQLExecute(hStmt);
if(ret == SQL_ERROR || ret == SQL_SUCCESS_WITH_INFO)
{
PrintError(hStmt,ret,FALSE);
SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
return FALSE;
}

SQLFreeHandle(SQL_HANDLE_STMT,hStmt);
CloseConnection();
return TRUE;

Generalbooks in SQL server 2000 Pin
nevhile.net4-Oct-03 3:02
nevhile.net4-Oct-03 3:02 
GeneralRe: books in SQL server 2000 Pin
Nino_14-Oct-03 5:30
Nino_14-Oct-03 5:30 
GeneralRe: books in SQL server 2000 Pin
SimonS4-Oct-03 10:39
SimonS4-Oct-03 10:39 
Generalcolesafearay class! Pin
ranjjj3-Oct-03 22:12
ranjjj3-Oct-03 22:12 
GeneralRe: colesafearay class! Pin
Mike Dimmick3-Oct-03 23:38
Mike Dimmick3-Oct-03 23:38 
GeneralSQL Server Yukon and 2000 Pin
nevhile.net3-Oct-03 20:27
nevhile.net3-Oct-03 20:27 
GeneralRe: SQL Server Yukon and 2000 Pin
Arjan Einbu3-Oct-03 23:19
Arjan Einbu3-Oct-03 23:19 
GeneralRe: SQL Server Yukon and 2000 Pin
Sabrina_c3-Oct-03 23:32
Sabrina_c3-Oct-03 23:32 
Generalbacking up/moving mssql databases Pin
djkno33-Oct-03 2:38
djkno33-Oct-03 2:38 
GeneralRe: backing up/moving mssql databases Pin
Mike Dimmick3-Oct-03 6:30
Mike Dimmick3-Oct-03 6:30 
GeneralRe: backing up/moving mssql databases Pin
djkno33-Oct-03 6:38
djkno33-Oct-03 6:38 
GeneralRe: backing up/moving mssql databases Pin
djkno36-Oct-03 8:11
djkno36-Oct-03 8:11 
GeneralRe: backing up/moving mssql databases Pin
Mike Dimmick6-Oct-03 23:20
Mike Dimmick6-Oct-03 23:20 
GeneralRe: backing up/moving mssql databases Pin
djkno37-Oct-03 4:18
djkno37-Oct-03 4:18 
GeneralRe: backing up/moving mssql databases Pin
Mike Dimmick7-Oct-03 22:39
Mike Dimmick7-Oct-03 22:39 
GeneralSqlDataAdapter.Update sometimes does not update Pin
james-cxx2-Oct-03 10:55
james-cxx2-Oct-03 10:55 
GeneralRe: SqlDataAdapter.Update sometimes does not update Pin
james-cxx14-Oct-03 18:18
james-cxx14-Oct-03 18:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.