Problem in ADODB.Command

Re: Problem in ADODB.Command

Postby sajith » Fri May 08, 2009 9:15 am

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  Expand view
//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  Expand view

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)
 
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India

Re: Problem in ADODB.Command

Postby nageswaragunupudi » Fri May 08, 2009 11:24 am

>>
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: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in ADODB.Command

Postby nageswaragunupudi » Fri May 08, 2009 11:33 am

I would be writing my code like this:
Code: Select all  Expand view
....

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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in ADODB.Command

Postby sajith » Sat May 09, 2009 10:25 am

Many thanks,
Still the same problem

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

Re: Problem in ADODB.Command

Postby nageswaragunupudi » Sat May 09, 2009 10:37 am

Mr Sajith

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

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

Re: Problem in ADODB.Command

Postby sajith » Sat May 09, 2009 10:47 am

Many thanks for ur kindness ,
I have attached the problem to ur mail ,plz view as per ur convenience
Regards,
Sajith
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 48 guests