Problem in ADODB.Command

sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by sajith »

sajith wrote:Many thanks Anserkk,nageshswaganpati for ur gorgeous support,

Half the problen is solved with ur reply,now my problem is how to assign a value to
Outputparameter frm FiveWin

Code: Select all

//Procedure
DROP PROCEDURE IF EXISTS yy.Sp_Job5;
CREATE PROCEDURE Sp_Job5(IN Ename varchar(25),In Job varchar(25),OUT Jcode varchar(20))
Begin
DECLARE code Varchar(50);
set @code=CONCAT(LEFT(Ename, 4),Job);
insert into job values(Ename,Job,@code);
set Jcode=code;
end;
call Sp_Job5( 'Sajith','007',@w);//here the problem lies in my Fivewin 

 

Code: Select all

oCommand:=CreateObject("ADODB.Command")
oCommand:ActiveConnection:=oCon
oCommand:CommandType:=adCmdStoredProc
oCommand:CommandText:="Sp_Job5"
oTest1:=oCommand:CreateParameter("Ename",adVarChar,adParamInput,25)
oCommand:Parameters:Append(oTest1)
oTest2:=oCommand:CreateParameter("Job",adVarChar,adParamInput,25)
oCommand:Parameters:Append(oTest2)

cName:=AllTrim(cName)
cJob:=AllTrim(cJob)
oCommand:Parameters("Ename"):Value:=cName
oCommand:Parameters("Job"):Value:=cJob

oTest3:=oCommand:CreateParameter("Jcode",adVarChar, adParamOutput,20)
oCommand:Parameters:Append(oTest3)
oCommand:Parameters("Jcode"):Value:=//Here problem lies i assigned input parameter to
//execute my procedure from fivewin i must give outputparameter as @w format it is not string type Plz view above Procedure
 //How can   i set that value to here oCommand:Parameters("Jcode"):Value:=? as this format(@w)

CATCH
   MsgInfo("Ado")
   ShowAdoError(oCon)
END

TRY
   oCommand:Execute()
 
  CATCH oError
        ShowSqlError(oError)
end

MsgInfo( oCommand:Parameters("Jcode"):Value)
 
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by nageswaragunupudi »

>>
oCommand:Parameters("Jcode"):Value:=//Here problem lies i assigned input parameter to
>>

You do not assign any value here.
After :Execute() command
you can say w := oCommane:Parameters("JCode"):Value
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by nageswaragunupudi »

I would be writing my code like this:

Code: Select all

....

MsgInfo( Sp_Job5( EName, Job ) )

...

function Sp_Job5( Ename, Job )

   static oCmd

   local oParam
   
   if oCmd == nil

      oCmd:=CreateObject("ADODB.Command")
      oCmd:ActiveConnection:=oCon
      oCmd:CommandType:=adCmdStoredProc
      oCmd:CommandText:="Sp_Job5"
      oParam := oCmd:CreateParameter( "Ename", adVarChar, adParamInput, 25 )
      oCmd:Parameters:Append( oParam )
      oParam := oCmd:CreateParameter( "Job",   adVarChar, adParamInput, 25 )
      oCmd:Parameters:Append( oParam )
      oparam :=oCmd:CreateParameter( "Jcode",  adVarChar, adParamOutput,20 )
      oCmd:Parameters:Append(oTest3)

   endif

   oCmd:Parameters( "Ename" ):Value := Trim( cName )
   oCmd:Parameters( "Job"   ):Value := Trim( cJob  )

   TRY
      oCmd:Execute()
   CATCH e
     ShowSqlError( e )
   END

Return oCmd:Parameters( "JCode" ):Value
 
Regards

G. N. Rao.
Hyderabad, India
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by sajith »

Many thanks,
Still the same problem

Regards,
Sajith
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by nageswaragunupudi »

Mr Sajith

Can you pls contact me on my email nageswaragunupudi@gmail.com ?
Regards

G. N. Rao.
Hyderabad, India
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in ADODB.Command

Post by sajith »

Many thanks for ur kindness ,
I have attached the problem to ur mail ,plz view as per ur convenience
Regards,
Sajith
Post Reply