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.

Getting <batch statement> Error

7 posts in General Discussion Last posting was on 2004-03-10 01:40:06.0Z
Chandresh Patel Posted on 2004-03-08 21:04:32.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
Subject: Getting <batch statement> Error
Lines: 21
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: ac8bd2d2.ipt.aol.com
X-Original-NNTP-Posting-Host: ac8bd2d2.ipt.aol.com
Message-ID: <404cdfe0@forums-1-dub>
Date: 8 Mar 2004 13:04:32 -0800
X-Trace: forums-1-dub 1078779872 172.139.210.210 (8 Mar 2004 13:04:32 -0800)
X-Original-Trace: 8 Mar 2004 13:04:32 -0800, ac8bd2d2.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2741
Article PK: 6212

Sybase Anywhere 9.0.0.1108

I created one procedure on server name "SalesData" and if i call this
procedure in local database it works fine but if i run this procedure in
Network Server then it gives me this error :

procedure call:
==========
Call SalesData(1,1,'2004-1-1','2004-3-8', 0)

Error:
====
Preparee statement not a cursor-specification: Result set not permitted in
'<batch statement>'

Can someone tell me what is the different in local server and network
server.

Thanks in advance.


Chris Keating (iAnywhere Solutions) Posted on 2004-03-09 15:00:20.0Z
From: "Chris Keating \(iAnywhere Solutions\)" <FightSpam_keating@iAnywhere.com>
Newsgroups: ianywhere.public.general
References: <404cdfe0@forums-1-dub>
Subject: Re: Getting <batch statement> Error
Lines: 57
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: <404ddc04$1@forums-1-dub>
Date: 9 Mar 2004 07:00:20 -0800
X-Trace: forums-1-dub 1078844420 172.31.141.1 (9 Mar 2004 07:00:20 -0800)
X-Original-Trace: 9 Mar 2004 07:00:20 -0800, keating-xp.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2749
Article PK: 6217

There is nothing specifically different that would affect how a stored
procedure is executed.



--

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:404cdfe0@forums-1-dub...
> Sybase Anywhere 9.0.0.1108
>
> I created one procedure on server name "SalesData" and if i call this
> procedure in local database it works fine but if i run this procedure in
> Network Server then it gives me this error :
>
> procedure call:
> ==========
> Call SalesData(1,1,'2004-1-1','2004-3-8', 0)
>
> Error:
> ====
> Preparee statement not a cursor-specification: Result set not permitted in
> '<batch statement>'
>
> Can someone tell me what is the different in local server and network
> server.
>
> Thanks in advance.
>
>


Chandresh Patel Posted on 2004-03-09 15:09:06.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <404cdfe0@forums-1-dub> <404ddc04$1@forums-1-dub>
Subject: Re: Getting <batch statement> Error
Lines: 73
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: ac83855a.ipt.aol.com
X-Original-NNTP-Posting-Host: ac83855a.ipt.aol.com
Message-ID: <404dde12@forums-1-dub>
Date: 9 Mar 2004 07:09:06 -0800
X-Trace: forums-1-dub 1078844946 172.131.133.90 (9 Mar 2004 07:09:06 -0800)
X-Original-Trace: 9 Mar 2004 07:09:06 -0800, ac83855a.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2751
Article PK: 6221

Then let me know why I get this error and what is the solution for this.







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

wrote in message news:404ddc04$1@forums-1-dub...
> There is nothing specifically different that would affect how a stored
> procedure is executed.
>
>
>
> --
>
> 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:404cdfe0@forums-1-dub...
> > Sybase Anywhere 9.0.0.1108
> >
> > I created one procedure on server name "SalesData" and if i call this
> > procedure in local database it works fine but if i run this procedure in
> > Network Server then it gives me this error :
> >
> > procedure call:
> > ==========
> > Call SalesData(1,1,'2004-1-1','2004-3-8', 0)
> >
> > Error:
> > ====
> > Preparee statement not a cursor-specification: Result set not permitted
in
> > '<batch statement>'
> >
> > Can someone tell me what is the different in local server and network
> > server.
> >
> > Thanks in advance.
> >
> >
>
>


Greg Fenton Posted on 2004-03-09 15:37:55.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 MultiZilla/1.6.2.0c
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: Getting <batch statement> Error
References: <404cdfe0@forums-1-dub> <404ddc04$1@forums-1-dub> <404dde12@forums-1-dub>
In-Reply-To: <404dde12@forums-1-dub>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: gfenton-xp.sybase.com
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <404de4d3$1@forums-1-dub>
Date: 9 Mar 2004 07:37:55 -0800
X-Trace: forums-1-dub 1078846675 172.31.141.199 (9 Mar 2004 07:37:55 -0800)
X-Original-Trace: 9 Mar 2004 07:37:55 -0800, gfenton-xp.sybase.com
Lines: 22
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2752
Article PK: 6223


Chandresh Patel wrote:
> Then let me know why I get this error and what is the solution for this.
>

Show us what you do differently between the two runs:

- what is the startup line for dbeng9?
- what is the startup line for dbsrv9?
- what tool are you connecting to the database with (ISQL? a
PowerBuilder app via ODBC? a VB.NET app using ASAProv?)
- how are you calling the SP?

Can you possibly post the SalesData code itself?

greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Chandresh Patel Posted on 2004-03-09 15:59:34.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <404cdfe0@forums-1-dub> <404ddc04$1@forums-1-dub> <404dde12@forums-1-dub> <404de4d3$1@forums-1-dub>
Subject: Re: Getting <batch statement> Error
Lines: 438
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: ac83855a.ipt.aol.com
X-Original-NNTP-Posting-Host: ac83855a.ipt.aol.com
Message-ID: <404de9e6@forums-1-dub>
Date: 9 Mar 2004 07:59:34 -0800
X-Trace: forums-1-dub 1078847974 172.131.133.90 (9 Mar 2004 07:59:34 -0800)
X-Original-Trace: 9 Mar 2004 07:59:34 -0800, ac83855a.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2753
Article PK: 6224

Hi,

In ISQL i connect through ODBC using dba user and same through C# connect
using ODBC and dba user. To calling from c# I am using ASAConnection,
ASACommand, ASADataReader.

Here is the code C#:
==============

// function used to return queried data
DataTable myDataTable = new DataTable();

DataRow myRow;


try

{

//run query

m_Cmd = m_Cnn.CreateCommand();

m_Cmd.CommandText = mySQL.ToString();

m_DataReader = m_Cmd.ExecuteReader();


// Define Table

myDataTable.Clear();

myDataTable.Columns.Clear();


for(int x=0;x<m_DataReader.FieldCount;x++)

{

if(m_DataReader.GetName(x) != "PeriodStartDate" && m_DataReader.GetName(x)
!= "PeriodEndDate")

myDataTable.Columns.Add(m_DataReader.GetName(x));

}


while (m_DataReader.Read())

{

// create a new row from table

myRow = myDataTable.NewRow();


//load row with data

for(int z=0;z<m_DataReader.FieldCount;z++)

{

if(m_DataReader.GetName(z) != "PeriodStartDate" && m_DataReader.GetName(z)
!= "PeriodEndDate")

myRow[m_DataReader.GetName(z)] = m_DataReader.GetValue(z);

}


myDataTable.Rows.Add(myRow);

}

m_DataReader.Close();

m_Cmd.Dispose();

}

catch(AsaException ex)

{

MessageBox.Show(ex.Message);

}

return myDataTable;



I attached my SalesData SP text file.

"Greg Fenton" <greg.fenton_NOSPAM_@ianywhere.com> wrote in message
news:404de4d3$1@forums-1-dub...
> Chandresh Patel wrote:
> > Then let me know why I get this error and what is the solution for this.
> >
>
> Show us what you do differently between the two runs:
>
> - what is the startup line for dbeng9?
> - what is the startup line for dbsrv9?
> - what tool are you connecting to the database with (ISQL? a
> PowerBuilder app via ODBC? a VB.NET app using ASAProv?)
> - how are you calling the SP?
>
> Can you possibly post the SalesData code itself?
>
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/


Chandresh Patel Posted on 2004-03-09 18:14:36.0Z
From: "Chandresh Patel" <bapashree@yahoo.com>
Newsgroups: ianywhere.public.general
References: <404cdfe0@forums-1-dub> <404ddc04$1@forums-1-dub> <404dde12@forums-1-dub> <404de4d3$1@forums-1-dub> <404de9e6@forums-1-dub>
Subject: Re: Getting <batch statement> Error
Lines: 157
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: ac83855a.ipt.aol.com
X-Original-NNTP-Posting-Host: ac83855a.ipt.aol.com
Message-ID: <404e098c@forums-1-dub>
Date: 9 Mar 2004 10:14:36 -0800
X-Trace: forums-1-dub 1078856076 172.131.133.90 (9 Mar 2004 10:14:36 -0800)
X-Original-Trace: 9 Mar 2004 10:14:36 -0800, ac83855a.ipt.aol.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2755
Article PK: 6222

Hi,

I found where i get error. Last two statement of procedure populate the
error

select @selectstring = 'select * from finalA order by PeriodStartDate DESC';
execute immediate @selectstring

In place of this i wrote

select * from finalA order by PeriodStartDate DESC

and code is working fine.



Can anybudy tell me what is the different between this two statements.

"Chandresh Patel" <bapashree@yahoo.com> wrote in message
news:404de9e6@forums-1-dub...
> Hi,
>
> In ISQL i connect through ODBC using dba user and same through C# connect
> using ODBC and dba user. To calling from c# I am using ASAConnection,
> ASACommand, ASADataReader.
>
> Here is the code C#:
> ==============
>
> // function used to return queried data
> DataTable myDataTable = new DataTable();
>
> DataRow myRow;
>
>
> try
>
> {
>
> //run query
>
> m_Cmd = m_Cnn.CreateCommand();
>
> m_Cmd.CommandText = mySQL.ToString();
>
> m_DataReader = m_Cmd.ExecuteReader();
>
>
> // Define Table
>
> myDataTable.Clear();
>
> myDataTable.Columns.Clear();
>
>
> for(int x=0;x<m_DataReader.FieldCount;x++)
>
> {
>
> if(m_DataReader.GetName(x) != "PeriodStartDate" && m_DataReader.GetName(x)
> != "PeriodEndDate")
>
> myDataTable.Columns.Add(m_DataReader.GetName(x));
>
> }
>
>
> while (m_DataReader.Read())
>
> {
>
> // create a new row from table
>
> myRow = myDataTable.NewRow();
>
>
> //load row with data
>
> for(int z=0;z<m_DataReader.FieldCount;z++)
>
> {
>
> if(m_DataReader.GetName(z) != "PeriodStartDate" && m_DataReader.GetName(z)
> != "PeriodEndDate")
>
> myRow[m_DataReader.GetName(z)] = m_DataReader.GetValue(z);
>
> }
>
>
> myDataTable.Rows.Add(myRow);
>
> }
>
> m_DataReader.Close();
>
> m_Cmd.Dispose();
>
> }
>
> catch(AsaException ex)
>
> {
>
> MessageBox.Show(ex.Message);
>
> }
>
> return myDataTable;
>
>
>
> I attached my SalesData SP text file.
>
>
>
>
>
>
>
>
>
> "Greg Fenton" <greg.fenton_NOSPAM_@ianywhere.com> wrote in message
> news:404de4d3$1@forums-1-dub...
> > Chandresh Patel wrote:
> > > Then let me know why I get this error and what is the solution for
this.
> > >
> >
> > Show us what you do differently between the two runs:
> >
> > - what is the startup line for dbeng9?
> > - what is the startup line for dbsrv9?
> > - what tool are you connecting to the database with (ISQL? a
> > PowerBuilder app via ODBC? a VB.NET app using ASAProv?)
> > - how are you calling the SP?
> >
> > Can you possibly post the SalesData code itself?
> >
> > greg.fenton
> > --
> > Greg Fenton
> > Consultant, Solution Services, iAnywhere Solutions
> > --------
> > Visit the iAnywhere Solutions Developer Community
> > Whitepapers, TechDocs, Downloads
> > http://www.ianywhere.com/developer/
>
>
>


Greg Fenton Posted on 2004-03-10 01:40:06.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 MultiZilla/1.6.2.0c
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: Getting <batch statement> Error
References: <404cdfe0@forums-1-dub> <404ddc04$1@forums-1-dub> <404dde12@forums-1-dub> <404de4d3$1@forums-1-dub> <404de9e6@forums-1-dub> <404e098c@forums-1-dub>
In-Reply-To: <404e098c@forums-1-dub>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: cpe000625d8278c-cm.cpe.net.cable.rogers.com
X-Original-NNTP-Posting-Host: cpe000625d8278c-cm.cpe.net.cable.rogers.com
Message-ID: <404e71f6$1@forums-1-dub>
Date: 9 Mar 2004 17:40:06 -0800
X-Trace: forums-1-dub 1078882806 24.112.254.75 (9 Mar 2004 17:40:06 -0800)
X-Original-Trace: 9 Mar 2004 17:40:06 -0800, cpe000625d8278c-cm.cpe.net.cable.rogers.com
Lines: 33
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2760
Article PK: 6230


Chandresh Patel wrote:
>
> In place of this i wrote
>
> select * from finalA order by PeriodStartDate DESC
>

As a "Best Practices", I strongly suggest that you replace the "*" in
the above statement with a proper list of the columns in your table.

The use of "*" is a convenience only. Using "*" does not guarantee an
order (or number) of columns that are returned. If down the road you
end up having to do some maintenance on your tables (add/drop columns,
drop and re-add the table, etc...) or even upgrade to another version,
there is NO GUARANTEE that the columns will come back in the order your
procedure is expecting.

If down the road you decide that you need an extra column on your table
for some completely different purpose (say a "last_modified" or a
"last_accessed_by" column), then any code using "*" needs to be revisited.

If you specify the columns directly, you guarantee that your code will
behave as expected.

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/