Click here to Skip to main content
16,011,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Return value from a stored procedure in ADO Pin
TyMatthews19-Sep-02 9:15
TyMatthews19-Sep-02 9:15 
GeneralRe: Return value from a stored procedure in ADO Pin
youssef20-Sep-02 3:14
youssef20-Sep-02 3:14 
GeneralRe: Return value from a stored procedure in ADO Pin
TyMatthews20-Sep-02 5:36
TyMatthews20-Sep-02 5:36 
GeneralRe: Return value from a stored procedure in ADO Pin
youssef20-Sep-02 5:48
youssef20-Sep-02 5:48 
GeneralRe: Return value from a stored procedure in ADO Pin
TyMatthews20-Sep-02 5:50
TyMatthews20-Sep-02 5:50 
GeneralRe: Return value from a stored procedure in ADO Pin
Carlos Antollini20-Sep-02 6:09
Carlos Antollini20-Sep-02 6:09 
GeneralRe: Return value from a stored procedure in ADO Pin
youssef20-Sep-02 7:38
youssef20-Sep-02 7:38 
GeneralRe: Return value from a stored procedure in ADO Pin
youssef20-Sep-02 10:16
youssef20-Sep-02 10:16 
When I execute my sample, now I have an IDispatch Error #3079 : error converting data char to int.

Please find the source code for checking where is the problem.
Other thing, I would like to know if I can specifie the NAME for each INPUT for the STORED PROCEDURE.

Best Regards

void CADO_SP_CARLOSDlg::OnButton1()
{
//Sample with Connection string for SQL Server

CADODatabase pAdoDb;
CString strConnection = _T("");

//strConnection = _T("Provider=MSDASQL;PersistSecurityInfo=False;"
// "Trusted_Connection=Yes;"
// "Data Source=Access Sql Server;catalog=sampledb");

strConnection = _T("provider=sqloledb.1;database=ARCHIVES_TVI;server=132.160.148.48;uid=Automat1;pwd=boulet");

pAdoDb.SetConnectionString(strConnection);

if(pAdoDb.Open())
{
m_editStatus = _T("OK");
}
else
{
m_editStatus = _T("KO");
}
UpdateData(FALSE);

//CADORecordset prs(&pAdoDb);

//Input Value
CADOParameter pParamIn_AutomatNr(CADORecordset::typeInteger, sizeof(int),CADOParameter::paramInput,_T("AutomatNr"));
CADOParameter pParamIn_FileName(CADORecordset::typeChar, sizeof(char) * 8, CADOParameter::paramInput,_T("FileName"));
//Output Value
CADOParameter pParamOutStatus(CADORecordset::typeInteger, sizeof(int), CADOParameter::paramOutput,_T("Status"));

//Set Datas to the Stored Procedure
pParamIn_AutomatNr.SetValue(1);
CString strFileName= "JK950213";
pParamIn_FileName.SetValue((_bstr_t) strFileName);

CADOCommand pCmd(&pAdoDb, "StartFileNumV3");

pCmd.AddParameter(&pParamIn_AutomatNr);
pCmd.AddParameter(&pParamIn_FileName);
pCmd.AddParameter(&pParamOutStatus);

CADORecordset pRs(&pAdoDb);

if(pRs.Execute(&pCmd))
{
CString str = _T("");
int nVal=0;
pParamOutStatus.GetValue(nVal);
}


}


the Stored Procedure :

CREATE PROCEDURE StartFileNumV3
(
@FileName varchar(8), @AutomatNr int, @Status int OUTPUT
)
AS
declare @Now datetime
declare @Nbr int
set @Nbr = (SELECT COUNT(*) FROM Num_Files WHERE (File_Name = @FileName))

if @Nbr = 1
begin
set @Nbr = (SELECT COUNT(*) FROM Num_Files WHERE (File_Name = @FileName) and (SetNumReady is not null) and (DateSetNumReady is not null))
if @Nbr = 1
begin
set @Now = GetDate()
UPDATE Num_Files SET Num_Go = @Now, AutomatNr = @AutomatNr WHERE File_Name = @FileName
SET @Status = 1
end
else
begin
/*La référence du fichier est présente dans la table, mais celle-ci ne doit pas se trouver dans la BétaCart ...*/
SET @Status = 2
end
end
else
begin
/*La référence du fichier n'est pas présente dans la table ...*/
SET @Status = 0
end

SELECT @Status
GO





youssef
Generalout of memory Pin
SamirSood19-Sep-02 7:15
SamirSood19-Sep-02 7:15 
GeneralRe: out of memory Pin
jmkhael19-Sep-02 7:42
jmkhael19-Sep-02 7:42 
GeneralRe: out of memory Pin
SamirSood19-Sep-02 20:37
SamirSood19-Sep-02 20:37 
GeneralTwo dimensional array Pin
needhelp5719-Sep-02 7:04
needhelp5719-Sep-02 7:04 
GeneralRe: Two dimensional array Pin
User 988519-Sep-02 7:04
User 988519-Sep-02 7:04 
GeneralRe: Two dimensional array Pin
needhelp5721-Sep-02 10:55
needhelp5721-Sep-02 10:55 
GeneralRe: Two dimensional array Pin
Michael Dunn19-Sep-02 7:53
sitebuilderMichael Dunn19-Sep-02 7:53 
GeneralRe: Two dimensional array Pin
valikac19-Sep-02 10:00
valikac19-Sep-02 10:00 
Generalmemory mapped file Pin
User 988519-Sep-02 6:43
User 988519-Sep-02 6:43 
GeneralRe: memory mapped file Pin
valikac19-Sep-02 10:06
valikac19-Sep-02 10:06 
GeneralRe: memory mapped file Pin
Neville Franks19-Sep-02 11:27
Neville Franks19-Sep-02 11:27 
GeneralRe: memory mapped file Pin
User 988519-Sep-02 15:35
User 988519-Sep-02 15:35 
GeneralRe: memory mapped file Pin
Neville Franks20-Sep-02 11:07
Neville Franks20-Sep-02 11:07 
GeneralRe: memory mapped file Pin
User 988520-Sep-02 12:11
User 988520-Sep-02 12:11 
GeneralRe: memory mapped file Pin
Neville Franks20-Sep-02 12:23
Neville Franks20-Sep-02 12:23 
GeneralAssigning character string to LPCWSTR Pin
abhinarulkar19-Sep-02 6:32
abhinarulkar19-Sep-02 6:32 
GeneralRe: Assigning character string to LPCWSTR Pin
dabs19-Sep-02 6:40
dabs19-Sep-02 6:40 

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.