CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    Posts
    290

    I get problem with execute storedprocedure by ADO.

    Error occur on line
    hr=pCommand->Execute(NULL,NULL,adCmdStoredProc);//
    I dont know what is the matter.
    thanks you so much

    HRESULT hr;
    ::_ConnectionPtr pConnection;
    ::_CommandPtr pCommand;
    // ::_ParameterPtr pParameter;
    pConnection.CreateInstance(__uuidof(Connection));
    pCommand.CreateInstance(__uuidof(Command));
    pConnection->Open("driver={SQL Server};server=caihui;database=assistent","clientsetup","02140214",adConnectUnspecified);
    pCommand->CommandText="{call ?=sp_clientSetup(?,?,?,?)}";

    pCommand->Parameters->Append(pCommand->CreateParameter("strUnit",adChar,adParamInput,9,_variant_t(m_strUnit)));
    pCommand->Parameters->Append(pCommand->CreateParameter("strMAC",adChar,adParamInput,12,_variant_t(m_strMAC)));
    pCommand->Parameters->Append(pCommand->CreateParameter("strPassword",adVarChar,adParamInput,16,_variant_t(m_strPassword)));
    pCommand->Parameters->Append(pCommand->CreateParameter("strNewPassword",adVarChar,adParamInput,16,_variant_t(m_strNewPassword)));
    // short iSize=0;
    pCommand->Parameters->Append(pCommand->CreateParameter("RETURN_VALUE",adInteger,adParamReturnValue,sizeof(int),_variant_t(short(0))));

    pCommand->ActiveConnection=pConnection;

    // _bstr_t str=((_bstr_t)pCommand->Parameters->Item["@strUnit"]->Value);

    try
    {
    hr=pCommand->Execute(NULL,NULL,adCmdStoredProc);//;0,pCommand->GetParameters(),adCmdStoredProc)))
    }

  2. #2
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    Can you specify the error?
    Regards,

    Emanuel Vaduva

  3. #3
    Join Date
    Mar 2002
    Posts
    290
    I got it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured