Re: SQL Stored Procedures
Try to format parameters like you would do with printf function
int i=56;
ExecuteSQL({call MyProc("MyString %d",i});
Re: SQL Stored Procedures
Hi,
I am not sure about the format of the parameters in your codes, while it is possible to send parameters into a stored procedure using SQL API.
Hope this will help.
SQLRETURN retcode;
TIMESTAMP_STRUCT dsDynamicCurDate;
SQLINTEGER
siIntRet;
SQLINTEGER
cbDynamicCurDate = 0,
cbIntRet = 0;
retcode = SQLPrepare(g_hstmt, (SQLCHAR*)
"{call ? := guanj.PkgMorrowPlan.Plan2Dynamic( ? )}",
SQL_NTS);
if (retcode == SQL_SUCCESS)
{
SQLBindParameter(g_hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG,
SQL_INTEGER, 0, 0, &siIntRet, 0, &cbIntRet);
SQLBindParameter(g_hstmt, 2, SQL_PARAM_INPUT, SQL_C_TIMESTAMP,
SQL_TIMESTAMP, 0, 0, &dsDynamicCurDate, 0, &cbDynamicCurDate);
COleDateTime dateTest = COleDateTime::GetCurrentTime();
dsDynamicCurDate.year = dateTest.GetYear();
dsDynamicCurDate.month = dateTest.GetMonth();
dsDynamicCurDate.hour = dateTest.GetHour();
dsDynamicCurDate.day = dateTest.GetDay();
dsDynamicCurDate.minute = dateTest.GetMinute();
dsDynamicCurDate.second = 0;
dsDynamicCurDate.fraction = 0;
retcode = SQLExecute(g_hstmt);
if (retcode != SQL_SUCCESS)
AfxMessageBox("Failed");
}
Re: SQL Stored Procedures
If you are working with SQL Server and MFC CDatabase classes try this:
db.ExecuteSQL("EXEC YourProc 'stringarg', intarg");
with "EXEC..."
you should be able to finish it up with a call identical to the ones you type in iSQL.
Software Engineer @ Interlinq Corp / Servicing Section