Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How do i get OUT parameter value in C#

9 posts in General Discussion Last posting was on 2004-02-21 18:27:39.0Z
Chandresh Patel Posted on 2004-02-20 05:56:30.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
Subject: How do i get OUT parameter value in C#
Lines: 25
Organization: Shreeji Smart Solution
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Original-NNTP-Posting-Host: ac8e483c.ipt.aol.com
Message-ID: <4035a18a@forums-2-dub>
X-Original-Trace: 19 Feb 2004 21:56:26 -0800, ac8e483c.ipt.aol.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 19 Feb 2004 21:56:25 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 19 Feb 2004 21:56:30 -0800
X-Trace: forums-1-dub 1077256590 10.22.108.75 (19 Feb 2004 21:56:30 -0800)
X-Original-Trace: 19 Feb 2004 21:56:30 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2564
Article PK: 5701

Hi,

I am using Sybase Anywhere 9.0.0 (1108) with C# and iAnywhere.Data.Client

I wrote one procedure and it has one OUT parameter. I want value of this in
C#. How do i get this value.

ALTER PROCEDURE "DBA"."InsertMasterLog"(
IN uid INT,
OUT aID INT)
BEGIN
Insert
into AccessLog
(LoginDateTime, UID)
values
(NOW(), uid);

SELECT @@IDENTITY INTO aID;
END

How do i get aID value in C#.

Thanks in Advance


Jason Hinsperger Posted on 2004-02-20 15:10:02.0Z
From: "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: hinsperg-pc1.sybase.com
X-Original-NNTP-Posting-Host: hinsperg-pc1.sybase.com
Message-ID: <4036234a$1@forums-1-dub>
Date: 20 Feb 2004 07:10:02 -0800
X-Trace: forums-1-dub 1077289802 172.31.143.226 (20 Feb 2004 07:10:02 -0800)
X-Original-Trace: 20 Feb 2004 07:10:02 -0800, hinsperg-pc1.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2567
Article PK: 5704

Something like the following code should work for you:

AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
SPCMD.CommandType = CommandType.StoredProcedure;

AsaParameter myParm = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );
AsaParameter myParm2 = SPCMD.Parameters.Add( "@arg2",AsaDbType.Integer );
AsaParameter myParm = SPCMD.Parameters.Add( "@test",AsaDbType.Integer, 32 );
SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput ;
SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput ;

SPCMD.ExecuteNonQuery();
MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );

--
Jason Hinsperger
International and Sustaining Engineering
iAnywhere Solutions

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer
--

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:4035a18a@forums-2-dub...
> Hi,
>
> I am using Sybase Anywhere 9.0.0 (1108) with C# and iAnywhere.Data.Client
>
> I wrote one procedure and it has one OUT parameter. I want value of this
in
> C#. How do i get this value.
>
> ALTER PROCEDURE "DBA"."InsertMasterLog"(
> IN uid INT,
> OUT aID INT)
> BEGIN
> Insert
> into AccessLog
> (LoginDateTime, UID)
> values
> (NOW(), uid);
>
> SELECT @@IDENTITY INTO aID;
> END
>
> How do i get aID value in C#.
>
> Thanks in Advance
>
>


Chandresh Patel Posted on 2004-02-20 16:48:26.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 79
Organization: Shreeji Smart Solution
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: ac825b9d.ipt.aol.com
X-Original-NNTP-Posting-Host: ac825b9d.ipt.aol.com
Message-ID: <40363a5a@forums-1-dub>
Date: 20 Feb 2004 08:48:26 -0800
X-Trace: forums-1-dub 1077295706 172.130.91.157 (20 Feb 2004 08:48:26 -0800)
X-Original-Trace: 20 Feb 2004 08:48:26 -0800, ac825b9d.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2569
Article PK: 5707

Hi,

You are right but I am calling procedure diffrent way like...

CommandType = "Call InsertMasterLog(11, here i don't know what i have to
pass)"

This way I am calling procedure and each time i pass parameter like this.

Now, tell me how do i get value of auto increment value.

Thanks in Advance..

"Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
news:4036234a$1@forums-1-dub...
> Something like the following code should work for you:
>
> AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> SPCMD.CommandType = CommandType.StoredProcedure;
>
> AsaParameter myParm = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );
> AsaParameter myParm2 = SPCMD.Parameters.Add( "@arg2",AsaDbType.Integer );
> AsaParameter myParm = SPCMD.Parameters.Add( "@test",AsaDbType.Integer,
32 );
> SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput ;
> SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput ;
>
> SPCMD.ExecuteNonQuery();
> MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
>
> --
> Jason Hinsperger
> International and Sustaining Engineering
> iAnywhere Solutions
>
> Whitepapers, TechDocs, and bug fixes are all available through the
iAnywhere
> Developer Community at www.ianywhere.com/developer
> --
>
>
>
> "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> news:4035a18a@forums-2-dub...
> > Hi,
> >
> > I am using Sybase Anywhere 9.0.0 (1108) with C# and
iAnywhere.Data.Client
> >
> > I wrote one procedure and it has one OUT parameter. I want value of this
> in
> > C#. How do i get this value.
> >
> > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > IN uid INT,
> > OUT aID INT)
> > BEGIN
> > Insert
> > into AccessLog
> > (LoginDateTime, UID)
> > values
> > (NOW(), uid);
> >
> > SELECT @@IDENTITY INTO aID;
> > END
> >
> > How do i get aID value in C#.
> >
> > Thanks in Advance
> >
> >
>
>


Chris Keating (iAnywhere Solutions) Posted on 2004-02-20 18:19:52.0Z
From: "Chris Keating \(iAnywhere Solutions\)" <FightSpam_keating@iAnywhere.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 114
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Original-NNTP-Posting-Host: keating-xp.sybase.com
Message-ID: <40364fc7$1@forums-2-dub>
X-Original-Trace: 20 Feb 2004 10:19:51 -0800, keating-xp.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 20 Feb 2004 10:19:44 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 20 Feb 2004 10:19:52 -0800
X-Trace: forums-1-dub 1077301192 10.22.108.75 (20 Feb 2004 10:19:52 -0800)
X-Original-Trace: 20 Feb 2004 10:19:52 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2571
Article PK: 5708

You can't do it this way as there is nowhere to put the value.

--

Chris Keating
Sybase Adaptive Server Anywhere Professional Version 8

****************************************************************************
*
Sign up today for your copy of the SQL Anywhere Studio 9 Developer Edition
and try out the market-leading database for mobile, embedded and small to
medium sized business environments for free!

http://www.ianywhere.com/promos/deved/index.html

****************************************************************************
*

iAnywhere Solutions http://www.iAnywhere.com

** Please only post to the newsgroup

** Whitepapers can be found at http://www.iAnywhere.com/developer
** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
** Use CaseXpress to report bugs http://casexpress.sybase.com

****************************************************************************
*

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:40363a5a@forums-1-dub...
> Hi,
>
> You are right but I am calling procedure diffrent way like...
>
> CommandType = "Call InsertMasterLog(11, here i don't know what i have to
> pass)"
>
> This way I am calling procedure and each time i pass parameter like this.
>
> Now, tell me how do i get value of auto increment value.
>
> Thanks in Advance..
>
>
>
>
> "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
> news:4036234a$1@forums-1-dub...
> > Something like the following code should work for you:
> >
> > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > SPCMD.CommandType = CommandType.StoredProcedure;
> >
> > AsaParameter myParm = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );
> > AsaParameter myParm2 = SPCMD.Parameters.Add(
"@arg2",AsaDbType.Integer );
> > AsaParameter myParm = SPCMD.Parameters.Add( "@test",AsaDbType.Integer,
> 32 );
> > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> > SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput ;
> > SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput ;
> >
> > SPCMD.ExecuteNonQuery();
> > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> >
> > --
> > Jason Hinsperger
> > International and Sustaining Engineering
> > iAnywhere Solutions
> >
> > Whitepapers, TechDocs, and bug fixes are all available through the
> iAnywhere
> > Developer Community at www.ianywhere.com/developer
> > --
> >
> >
> >
> > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > news:4035a18a@forums-2-dub...
> > > Hi,
> > >
> > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> iAnywhere.Data.Client
> > >
> > > I wrote one procedure and it has one OUT parameter. I want value of
this
> > in
> > > C#. How do i get this value.
> > >
> > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > IN uid INT,
> > > OUT aID INT)
> > > BEGIN
> > > Insert
> > > into AccessLog
> > > (LoginDateTime, UID)
> > > values
> > > (NOW(), uid);
> > >
> > > SELECT @@IDENTITY INTO aID;
> > > END
> > >
> > > How do i get aID value in C#.
> > >
> > > Thanks in Advance
> > >
> > >
> >
> >
>
>


Jason Hinsperger Posted on 2004-02-20 18:37:07.0Z
From: "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Original-NNTP-Posting-Host: hinsperg-pc1.sybase.com
Message-ID: <403653d2$1@forums-2-dub>
X-Original-Trace: 20 Feb 2004 10:37:06 -0800, hinsperg-pc1.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 20 Feb 2004 10:36:59 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 20 Feb 2004 10:37:07 -0800
X-Trace: forums-1-dub 1077302227 10.22.108.75 (20 Feb 2004 10:37:07 -0800)
X-Original-Trace: 20 Feb 2004 10:37:07 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2572
Article PK: 5709

I see no reason why you cannot use the method I gave you. You can set each
parameter to whatever you like. If the parameter is an output parameter,
you don't set it to anything, but you have to declare it so there is a place
for the result to go.

--
Jason Hinsperger
International and Sustaining Engineering
iAnywhere Solutions

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer
--

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:40363a5a@forums-1-dub...
> Hi,
>
> You are right but I am calling procedure diffrent way like...
>
> CommandType = "Call InsertMasterLog(11, here i don't know what i have to
> pass)"
>
> This way I am calling procedure and each time i pass parameter like this.
>
> Now, tell me how do i get value of auto increment value.
>
> Thanks in Advance..
>
>
>
>
> "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
> news:4036234a$1@forums-1-dub...
> > Something like the following code should work for you:
> >
> > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > SPCMD.CommandType = CommandType.StoredProcedure;
> >
> > AsaParameter myParm = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );
> > AsaParameter myParm2 = SPCMD.Parameters.Add(
"@arg2",AsaDbType.Integer );
> > AsaParameter myParm = SPCMD.Parameters.Add( "@test",AsaDbType.Integer,
> 32 );
> > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> > SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput ;
> > SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput ;
> >
> > SPCMD.ExecuteNonQuery();
> > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> >
> > --
> > Jason Hinsperger
> > International and Sustaining Engineering
> > iAnywhere Solutions
> >
> > Whitepapers, TechDocs, and bug fixes are all available through the
> iAnywhere
> > Developer Community at www.ianywhere.com/developer
> > --
> >
> >
> >
> > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > news:4035a18a@forums-2-dub...
> > > Hi,
> > >
> > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> iAnywhere.Data.Client
> > >
> > > I wrote one procedure and it has one OUT parameter. I want value of
this
> > in
> > > C#. How do i get this value.
> > >
> > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > IN uid INT,
> > > OUT aID INT)
> > > BEGIN
> > > Insert
> > > into AccessLog
> > > (LoginDateTime, UID)
> > > values
> > > (NOW(), uid);
> > >
> > > SELECT @@IDENTITY INTO aID;
> > > END
> > >
> > > How do i get aID value in C#.
> > >
> > > Thanks in Advance
> > >
> > >
> >
> >
>
>


Chandresh Patel Posted on 2004-02-20 19:02:59.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub> <403653d2$1@forums-2-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 117
Organization: Shreeji Smart Solution
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Original-NNTP-Posting-Host: ac825b9d.ipt.aol.com
Message-ID: <403659e0@forums-2-dub>
X-Original-Trace: 20 Feb 2004 11:02:56 -0800, ac825b9d.ipt.aol.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 20 Feb 2004 11:02:50 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 20 Feb 2004 11:02:59 -0800
X-Trace: forums-1-dub 1077303779 10.22.108.75 (20 Feb 2004 11:02:59 -0800)
X-Original-Trace: 20 Feb 2004 11:02:59 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2573
Article PK: 5712

Hi,

Yes I am going to use this method but let me know how do i pass my value in
to @arg1 parameter.


Thanks in Advance.

"Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
news:403653d2$1@forums-2-dub...
> I see no reason why you cannot use the method I gave you. You can set
each
> parameter to whatever you like. If the parameter is an output parameter,
> you don't set it to anything, but you have to declare it so there is a
place
> for the result to go.
>
> --
> Jason Hinsperger
> International and Sustaining Engineering
> iAnywhere Solutions
>
> Whitepapers, TechDocs, and bug fixes are all available through the
iAnywhere
> Developer Community at www.ianywhere.com/developer
> --
>
>
> "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> news:40363a5a@forums-1-dub...
> > Hi,
> >
> > You are right but I am calling procedure diffrent way like...
> >
> > CommandType = "Call InsertMasterLog(11, here i don't know what i have to
> > pass)"
> >
> > This way I am calling procedure and each time i pass parameter like
this.
> >
> > Now, tell me how do i get value of auto increment value.
> >
> > Thanks in Advance..
> >
> >
> >
> >
> > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
> > news:4036234a$1@forums-1-dub...
> > > Something like the following code should work for you:
> > >
> > > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > > SPCMD.CommandType = CommandType.StoredProcedure;
> > >
> > > AsaParameter myParm = SPCMD.Parameters.Add(
"@arg1",AsaDbType.Integer );
> > > AsaParameter myParm2 = SPCMD.Parameters.Add(
> "@arg2",AsaDbType.Integer );
> > > AsaParameter myParm = SPCMD.Parameters.Add( "@test",AsaDbType.Integer,
> > 32 );
> > > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> > > SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput ;
> > > SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput ;
> > >
> > > SPCMD.ExecuteNonQuery();
> > > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> > >
> > > --
> > > Jason Hinsperger
> > > International and Sustaining Engineering
> > > iAnywhere Solutions
> > >
> > > Whitepapers, TechDocs, and bug fixes are all available through the
> > iAnywhere
> > > Developer Community at www.ianywhere.com/developer
> > > --
> > >
> > >
> > >
> > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > news:4035a18a@forums-2-dub...
> > > > Hi,
> > > >
> > > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> > iAnywhere.Data.Client
> > > >
> > > > I wrote one procedure and it has one OUT parameter. I want value of
> this
> > > in
> > > > C#. How do i get this value.
> > > >
> > > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > > IN uid INT,
> > > > OUT aID INT)
> > > > BEGIN
> > > > Insert
> > > > into AccessLog
> > > > (LoginDateTime, UID)
> > > > values
> > > > (NOW(), uid);
> > > >
> > > > SELECT @@IDENTITY INTO aID;
> > > > END
> > > >
> > > > How do i get aID value in C#.
> > > >
> > > > Thanks in Advance
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Chandresh Patel Posted on 2004-02-20 19:18:32.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub> <403653d2$1@forums-2-dub> <403659e0@forums-2-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 168
Organization: Shreeji Smart Solution
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Original-NNTP-Posting-Host: ac825b9d.ipt.aol.com
Message-ID: <40365d87@forums-2-dub>
X-Original-Trace: 20 Feb 2004 11:18:31 -0800, ac825b9d.ipt.aol.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 20 Feb 2004 11:18:24 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 20 Feb 2004 11:18:32 -0800
X-Trace: forums-1-dub 1077304712 10.22.108.75 (20 Feb 2004 11:18:32 -0800)
X-Original-Trace: 20 Feb 2004 11:18:32 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2575
Article PK: 5710

Here is code and let me know how do i call this method

MyProcedure
=========
ALTER PROCEDURE "DBA"."InsertMasterLog"(IN @uid integer, OUT @aID integer)
BEGIN
Insert into AccessLog (LoginDateTime,UID) values (now(), @uid);
SELECT @@IDENTITY INTO @aID;
END


C# code
======

AsaCommand SPCMD = new AsaCommand("InsertMasterLog", m_Cnn);

SPCMD.CommandType = CommandType.StoredProcedure;

AsaParameter myParm1 = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );

AsaParameter myParm2 = SPCMD.Parameters.Add("@test",AsaDbType.Integer, 32 );

SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;

SPCMD.Parameters["@arg1"].Direction = ParameterDirection.Input;

SPCMD.ExecuteNonQuery();

OutParam = Convert.ToInt32(SPCMD.Parameters["@test"].Value.ToString());



Thanks in Advance.

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:403659e0@forums-2-dub...
> Hi,
>
> Yes I am going to use this method but let me know how do i pass my value
in
> to @arg1 parameter.
>
>
> Thanks in Advance.
>
> "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
> news:403653d2$1@forums-2-dub...
> > I see no reason why you cannot use the method I gave you. You can set
> each
> > parameter to whatever you like. If the parameter is an output
parameter,
> > you don't set it to anything, but you have to declare it so there is a
> place
> > for the result to go.
> >
> > --
> > Jason Hinsperger
> > International and Sustaining Engineering
> > iAnywhere Solutions
> >
> > Whitepapers, TechDocs, and bug fixes are all available through the
> iAnywhere
> > Developer Community at www.ianywhere.com/developer
> > --
> >
> >
> > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > news:40363a5a@forums-1-dub...
> > > Hi,
> > >
> > > You are right but I am calling procedure diffrent way like...
> > >
> > > CommandType = "Call InsertMasterLog(11, here i don't know what i have
to
> > > pass)"
> > >
> > > This way I am calling procedure and each time i pass parameter like
> this.
> > >
> > > Now, tell me how do i get value of auto increment value.
> > >
> > > Thanks in Advance..
> > >
> > >
> > >
> > >
> > > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in
message
> > > news:4036234a$1@forums-1-dub...
> > > > Something like the following code should work for you:
> > > >
> > > > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > > > SPCMD.CommandType = CommandType.StoredProcedure;
> > > >
> > > > AsaParameter myParm = SPCMD.Parameters.Add(
> "@arg1",AsaDbType.Integer );
> > > > AsaParameter myParm2 = SPCMD.Parameters.Add(
> > "@arg2",AsaDbType.Integer );
> > > > AsaParameter myParm = SPCMD.Parameters.Add(
"@test",AsaDbType.Integer,
> > > 32 );
> > > > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> > > > SPCMD.Parameters["@arg1"].Direction = ParameterDirection.InputOutput
;
> > > > SPCMD.Parameters["@arg2"].Direction = ParameterDirection.InputOutput
;
> > > >
> > > > SPCMD.ExecuteNonQuery();
> > > > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> > > >
> > > > --
> > > > Jason Hinsperger
> > > > International and Sustaining Engineering
> > > > iAnywhere Solutions
> > > >
> > > > Whitepapers, TechDocs, and bug fixes are all available through the
> > > iAnywhere
> > > > Developer Community at www.ianywhere.com/developer
> > > > --
> > > >
> > > >
> > > >
> > > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > > news:4035a18a@forums-2-dub...
> > > > > Hi,
> > > > >
> > > > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> > > iAnywhere.Data.Client
> > > > >
> > > > > I wrote one procedure and it has one OUT parameter. I want value
of
> > this
> > > > in
> > > > > C#. How do i get this value.
> > > > >
> > > > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > > > IN uid INT,
> > > > > OUT aID INT)
> > > > > BEGIN
> > > > > Insert
> > > > > into AccessLog
> > > > > (LoginDateTime, UID)
> > > > > values
> > > > > (NOW(), uid);
> > > > >
> > > > > SELECT @@IDENTITY INTO aID;
> > > > > END
> > > > >
> > > > > How do i get aID value in C#.
> > > > >
> > > > > Thanks in Advance
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Chris Keating (iAnywhere Solutions) Posted on 2004-02-20 20:57:35.0Z
From: "Chris Keating \(iAnywhere Solutions\)" <FightSpam_keating@iAnywhere.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub> <403653d2$1@forums-2-dub> <403659e0@forums-2-dub> <40365d87@forums-2-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 211
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: keating-xp.sybase.com
X-Original-NNTP-Posting-Host: keating-xp.sybase.com
Message-ID: <403674bf$1@forums-1-dub>
Date: 20 Feb 2004 12:57:35 -0800
X-Trace: forums-1-dub 1077310655 172.31.141.1 (20 Feb 2004 12:57:35 -0800)
X-Original-Trace: 20 Feb 2004 12:57:35 -0800, keating-xp.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2577
Article PK: 5713

Add the following line of code at some point before you execute the query:

myParm1.Value =11

BTW
There is some excellent documentation related to .NET programming on
msdn.microsoft.com which could help you answer many of you questions.

--

Chris Keating
Sybase Adaptive Server Anywhere Professional Version 8

****************************************************************************
*
Sign up today for your copy of the SQL Anywhere Studio 9 Developer Edition
and try out the market-leading database for mobile, embedded and small to
medium sized business environments for free!

http://www.ianywhere.com/promos/deved/index.html

****************************************************************************
*

iAnywhere Solutions http://www.iAnywhere.com

** Please only post to the newsgroup

** Whitepapers can be found at http://www.iAnywhere.com/developer
** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
** Use CaseXpress to report bugs http://casexpress.sybase.com

****************************************************************************
*

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:40365d87@forums-2-dub...
> Here is code and let me know how do i call this method
>
> MyProcedure
> =========
> ALTER PROCEDURE "DBA"."InsertMasterLog"(IN @uid integer, OUT @aID integer)
> BEGIN
> Insert into AccessLog (LoginDateTime,UID) values (now(), @uid);
> SELECT @@IDENTITY INTO @aID;
> END
>
>
> C# code
> ======
>
> AsaCommand SPCMD = new AsaCommand("InsertMasterLog", m_Cnn);
>
> SPCMD.CommandType = CommandType.StoredProcedure;
>
> AsaParameter myParm1 = SPCMD.Parameters.Add( "@arg1",AsaDbType.Integer );
>
> AsaParameter myParm2 = SPCMD.Parameters.Add("@test",AsaDbType.Integer,
32 );
>
> SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
>
> SPCMD.Parameters["@arg1"].Direction = ParameterDirection.Input;
>
> SPCMD.ExecuteNonQuery();
>
> OutParam = Convert.ToInt32(SPCMD.Parameters["@test"].Value.ToString());
>
>
>
> Thanks in Advance.
>
>
>
>
>
>
> "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> news:403659e0@forums-2-dub...
> > Hi,
> >
> > Yes I am going to use this method but let me know how do i pass my value
> in
> > to @arg1 parameter.
> >
> >
> > Thanks in Advance.
> >
> > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in message
> > news:403653d2$1@forums-2-dub...
> > > I see no reason why you cannot use the method I gave you. You can set
> > each
> > > parameter to whatever you like. If the parameter is an output
> parameter,
> > > you don't set it to anything, but you have to declare it so there is a
> > place
> > > for the result to go.
> > >
> > > --
> > > Jason Hinsperger
> > > International and Sustaining Engineering
> > > iAnywhere Solutions
> > >
> > > Whitepapers, TechDocs, and bug fixes are all available through the
> > iAnywhere
> > > Developer Community at www.ianywhere.com/developer
> > > --
> > >
> > >
> > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > news:40363a5a@forums-1-dub...
> > > > Hi,
> > > >
> > > > You are right but I am calling procedure diffrent way like...
> > > >
> > > > CommandType = "Call InsertMasterLog(11, here i don't know what i
have
> to
> > > > pass)"
> > > >
> > > > This way I am calling procedure and each time i pass parameter like
> > this.
> > > >
> > > > Now, tell me how do i get value of auto increment value.
> > > >
> > > > Thanks in Advance..
> > > >
> > > >
> > > >
> > > >
> > > > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in
> message
> > > > news:4036234a$1@forums-1-dub...
> > > > > Something like the following code should work for you:
> > > > >
> > > > > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > > > > SPCMD.CommandType = CommandType.StoredProcedure;
> > > > >
> > > > > AsaParameter myParm = SPCMD.Parameters.Add(
> > "@arg1",AsaDbType.Integer );
> > > > > AsaParameter myParm2 = SPCMD.Parameters.Add(
> > > "@arg2",AsaDbType.Integer );
> > > > > AsaParameter myParm = SPCMD.Parameters.Add(
> "@test",AsaDbType.Integer,
> > > > 32 );
> > > > > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> > > > > SPCMD.Parameters["@arg1"].Direction =
ParameterDirection.InputOutput
> ;
> > > > > SPCMD.Parameters["@arg2"].Direction =
ParameterDirection.InputOutput
> ;
> > > > >
> > > > > SPCMD.ExecuteNonQuery();
> > > > > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> > > > >
> > > > > --
> > > > > Jason Hinsperger
> > > > > International and Sustaining Engineering
> > > > > iAnywhere Solutions
> > > > >
> > > > > Whitepapers, TechDocs, and bug fixes are all available through the
> > > > iAnywhere
> > > > > Developer Community at www.ianywhere.com/developer
> > > > > --
> > > > >
> > > > >
> > > > >
> > > > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > > > news:4035a18a@forums-2-dub...
> > > > > > Hi,
> > > > > >
> > > > > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> > > > iAnywhere.Data.Client
> > > > > >
> > > > > > I wrote one procedure and it has one OUT parameter. I want value
> of
> > > this
> > > > > in
> > > > > > C#. How do i get this value.
> > > > > >
> > > > > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > > > > IN uid INT,
> > > > > > OUT aID INT)
> > > > > > BEGIN
> > > > > > Insert
> > > > > > into AccessLog
> > > > > > (LoginDateTime, UID)
> > > > > > values
> > > > > > (NOW(), uid);
> > > > > >
> > > > > > SELECT @@IDENTITY INTO aID;
> > > > > > END
> > > > > >
> > > > > > How do i get aID value in C#.
> > > > > >
> > > > > > Thanks in Advance
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Chandresh Patel Posted on 2004-02-21 18:27:39.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <4035a18a@forums-2-dub> <4036234a$1@forums-1-dub> <40363a5a@forums-1-dub> <403653d2$1@forums-2-dub> <403659e0@forums-2-dub> <40365d87@forums-2-dub> <403674bf$1@forums-1-dub>
Subject: Re: How do i get OUT parameter value in C#
Lines: 233
Organization: Shreeji Smart Solution
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: acaf3b9e.ipt.aol.com
X-Original-NNTP-Posting-Host: acaf3b9e.ipt.aol.com
Message-ID: <4037a31b@forums-1-dub>
Date: 21 Feb 2004 10:27:39 -0800
X-Trace: forums-1-dub 1077388059 172.175.59.158 (21 Feb 2004 10:27:39 -0800)
X-Original-Trace: 21 Feb 2004 10:27:39 -0800, acaf3b9e.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2578
Article PK: 5715

Thank you




"Chris Keating (iAnywhere Solutions)" <FightSpam_keating@iAnywhere.com>

wrote in message news:403674bf$1@forums-1-dub...
> Add the following line of code at some point before you execute the query:
>
> myParm1.Value =11
>
> BTW
> There is some excellent documentation related to .NET programming on
> msdn.microsoft.com which could help you answer many of you questions.
>
> --
>
> Chris Keating
> Sybase Adaptive Server Anywhere Professional Version 8
>
>
****************************************************************************
> *
> Sign up today for your copy of the SQL Anywhere Studio 9 Developer Edition
> and try out the market-leading database for mobile, embedded and small to
> medium sized business environments for free!
>
> http://www.ianywhere.com/promos/deved/index.html
>
>
****************************************************************************
> *
>
> iAnywhere Solutions http://www.iAnywhere.com
>
> ** Please only post to the newsgroup
>
> ** Whitepapers can be found at http://www.iAnywhere.com/developer
> ** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
> ** Use CaseXpress to report bugs http://casexpress.sybase.com
>
>
****************************************************************************
> *
>
> "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> news:40365d87@forums-2-dub...
> > Here is code and let me know how do i call this method
> >
> > MyProcedure
> > =========
> > ALTER PROCEDURE "DBA"."InsertMasterLog"(IN @uid integer, OUT @aID
integer)
> > BEGIN
> > Insert into AccessLog (LoginDateTime,UID) values (now(), @uid);
> > SELECT @@IDENTITY INTO @aID;
> > END
> >
> >
> > C# code
> > ======
> >
> > AsaCommand SPCMD = new AsaCommand("InsertMasterLog", m_Cnn);
> >
> > SPCMD.CommandType = CommandType.StoredProcedure;
> >
> > AsaParameter myParm1 = SPCMD.Parameters.Add(
"@arg1",AsaDbType.Integer );
> >
> > AsaParameter myParm2 = SPCMD.Parameters.Add("@test",AsaDbType.Integer,
> 32 );
> >
> > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output ;
> >
> > SPCMD.Parameters["@arg1"].Direction = ParameterDirection.Input;
> >
> > SPCMD.ExecuteNonQuery();
> >
> > OutParam = Convert.ToInt32(SPCMD.Parameters["@test"].Value.ToString());
> >
> >
> >
> > Thanks in Advance.
> >
> >
> >
> >
> >
> >
> > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > news:403659e0@forums-2-dub...
> > > Hi,
> > >
> > > Yes I am going to use this method but let me know how do i pass my
value
> > in
> > > to @arg1 parameter.
> > >
> > >
> > > Thanks in Advance.
> > >
> > > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in
message
> > > news:403653d2$1@forums-2-dub...
> > > > I see no reason why you cannot use the method I gave you. You can
set
> > > each
> > > > parameter to whatever you like. If the parameter is an output
> > parameter,
> > > > you don't set it to anything, but you have to declare it so there is
a
> > > place
> > > > for the result to go.
> > > >
> > > > --
> > > > Jason Hinsperger
> > > > International and Sustaining Engineering
> > > > iAnywhere Solutions
> > > >
> > > > Whitepapers, TechDocs, and bug fixes are all available through the
> > > iAnywhere
> > > > Developer Community at www.ianywhere.com/developer
> > > > --
> > > >
> > > >
> > > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > > news:40363a5a@forums-1-dub...
> > > > > Hi,
> > > > >
> > > > > You are right but I am calling procedure diffrent way like...
> > > > >
> > > > > CommandType = "Call InsertMasterLog(11, here i don't know what i
> have
> > to
> > > > > pass)"
> > > > >
> > > > > This way I am calling procedure and each time i pass parameter
like
> > > this.
> > > > >
> > > > > Now, tell me how do i get value of auto increment value.
> > > > >
> > > > > Thanks in Advance..
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com> wrote in
> > message
> > > > > news:4036234a$1@forums-1-dub...
> > > > > > Something like the following code should work for you:
> > > > > >
> > > > > > AsaCommand SPCMD = new AsaCommand("test2", myLocalConnection);
> > > > > > SPCMD.CommandType = CommandType.StoredProcedure;
> > > > > >
> > > > > > AsaParameter myParm = SPCMD.Parameters.Add(
> > > "@arg1",AsaDbType.Integer );
> > > > > > AsaParameter myParm2 = SPCMD.Parameters.Add(
> > > > "@arg2",AsaDbType.Integer );
> > > > > > AsaParameter myParm = SPCMD.Parameters.Add(
> > "@test",AsaDbType.Integer,
> > > > > 32 );
> > > > > > SPCMD.Parameters["@test"].Direction = ParameterDirection.Output
;
> > > > > > SPCMD.Parameters["@arg1"].Direction =
> ParameterDirection.InputOutput
> > ;
> > > > > > SPCMD.Parameters["@arg2"].Direction =
> ParameterDirection.InputOutput
> > ;
> > > > > >
> > > > > > SPCMD.ExecuteNonQuery();
> > > > > > MeRefNo = Convert.ToString( SPCMD.Parameters["@test"].Value );
> > > > > >
> > > > > > --
> > > > > > Jason Hinsperger
> > > > > > International and Sustaining Engineering
> > > > > > iAnywhere Solutions
> > > > > >
> > > > > > Whitepapers, TechDocs, and bug fixes are all available through
the
> > > > > iAnywhere
> > > > > > Developer Community at www.ianywhere.com/developer
> > > > > > --
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Chandresh Patel" <bapashree@yahoo.com> wrote in message
> > > > > > news:4035a18a@forums-2-dub...
> > > > > > > Hi,
> > > > > > >
> > > > > > > I am using Sybase Anywhere 9.0.0 (1108) with C# and
> > > > > iAnywhere.Data.Client
> > > > > > >
> > > > > > > I wrote one procedure and it has one OUT parameter. I want
value
> > of
> > > > this
> > > > > > in
> > > > > > > C#. How do i get this value.
> > > > > > >
> > > > > > > ALTER PROCEDURE "DBA"."InsertMasterLog"(
> > > > > > > IN uid INT,
> > > > > > > OUT aID INT)
> > > > > > > BEGIN
> > > > > > > Insert
> > > > > > > into AccessLog
> > > > > > > (LoginDateTime, UID)
> > > > > > > values
> > > > > > > (NOW(), uid);
> > > > > > >
> > > > > > > SELECT @@IDENTITY INTO aID;
> > > > > > > END
> > > > > > >
> > > > > > > How do i get aID value in C#.
> > > > > > >
> > > > > > > Thanks in Advance
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>