Subject: Stored procedure ADO
Category: AdvancedUI
Hi,
I working with Stored Procedure with a SQL Database.
I use a procedure for writing to the database 2 paramaters (a STRING and a INTEGER).
My procedure working with the STRING but not when I writing a INTEGER. It is probably in my code at pParam1.
If anyone can help me for this is great.
My code :
_ConnectionPtr pConn("ADODB.Connection"
_ParameterPtr pParam2,pParam1;
CString strFileName = "JK010104";
int iBetacart = 1;
pConn->Open("provider=sqloledb.1;database=ARCHIVES_TVI;server=100.100.100.100;uid=Me;pwd=xxx;network=dbmssocn","","",adConnectUnspecified);
_CommandPtr pCmd("ADODB.Command"
pCmd->ActiveConnection = pConn;
//Cmd->CommandText = "StartFileNum";
pCmd->CommandText = "ResetFileNum";
// pCmd->CommandText = "EndSuccesFileNum";
pCmd->CommandTimeout = 20;
pCmd->CommandType = adCmdStoredProc;
// _RecordsetPtr pRst("ADODB.Recordset"
// pRst = pCmd->Execute(NULL, NULL, adCmdStoredProc);
pParam2 = pCmd->CreateParameter ( _bstr_t ("File_Name", adVarChar,
adParamInput, strFileName.GetLength (), (_bstr_t) strFileName);
pCmd->Parameters->Append ( pParam2);
Param1 = pCmd->CreateParameter ( _bstr_t ("AutomatNr", adInteger,
adParamInput, sizeof (int), _variant_t ( long (iBetacart)));
pCmd->Parameters->Append ( pParam1);
_RecordsetPtr pRecordset;
pRecordset.CreateInstance(__uuidof(Recordset));
pRecordset = pCmd->Execute(NULL, NULL, adCmdStoredProc);
youssef
Category: AdvancedUI
Hi,
I working with Stored Procedure with a SQL Database.
I use a procedure for writing to the database 2 paramaters (a STRING and a INTEGER).
My procedure working with the STRING but not when I writing a INTEGER. It is probably in my code at pParam1.
If anyone can help me for this is great.
My code :
_ConnectionPtr pConn("ADODB.Connection"
_ParameterPtr pParam2,pParam1;
CString strFileName = "JK010104";
int iBetacart = 1;
pConn->Open("provider=sqloledb.1;database=ARCHIVES_TVI;server=100.100.100.100;uid=Me;pwd=xxx;network=dbmssocn","","",adConnectUnspecified);
_CommandPtr pCmd("ADODB.Command"
pCmd->ActiveConnection = pConn;
//Cmd->CommandText = "StartFileNum";
pCmd->CommandText = "ResetFileNum";
// pCmd->CommandText = "EndSuccesFileNum";
pCmd->CommandTimeout = 20;
pCmd->CommandType = adCmdStoredProc;
// _RecordsetPtr pRst("ADODB.Recordset"
// pRst = pCmd->Execute(NULL, NULL, adCmdStoredProc);
pParam2 = pCmd->CreateParameter ( _bstr_t ("File_Name", adVarChar,
adParamInput, strFileName.GetLength (), (_bstr_t) strFileName);
pCmd->Parameters->Append ( pParam2);
Param1 = pCmd->CreateParameter ( _bstr_t ("AutomatNr", adInteger,
adParamInput, sizeof (int), _variant_t ( long (iBetacart)));
pCmd->Parameters->Append ( pParam1);
_RecordsetPtr pRecordset;
pRecordset.CreateInstance(__uuidof(Recordset));
pRecordset = pCmd->Execute(NULL, NULL, adCmdStoredProc);
youssef