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.

Parameter missing, query failed

2 posts in General Discussion Last posting was on 2009-11-02 13:30:37.0Z
Don Posted on 2009-11-02 13:08:47.0Z
Sender: 50ca.4aeed7e4.1804289383@sybase.com
From: Don
Newsgroups: ianywhere.public.general
Subject: Parameter missing, query failed
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4aeed9df.50f9.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Nov 2009 05:08:47 -0800
X-Trace: forums-1-dub 1257167327 10.22.241.41 (2 Nov 2009 05:08:47 -0800)
X-Original-Trace: 2 Nov 2009 05:08:47 -0800, 10.22.241.41
Lines: 38
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7788
Article PK: 6822

Hi all, hopefully a simple answer. I'm just getting started
and running into a roadblock. I've been doing SQL for
years, and understand the principles of Parameters vs
SQL-Injection and applied with other back-ends.

I'm using C#.Net and going against Advantage Local Server,
created a database, added a new table. I'm trying to do a
simple query with 2 parameters and have as follows...



AdsCommand oCmd = new AdsCommand("SELECT A1.MSLID FROM
MyTable A1 WHERE A1.Field1 = ? AND A1.Field2 = ? ");

AdsParameter oParm1 = new AdsParameter();
oParm1.Value = "myvalue";
oParm1.DbType = DbType.String;

AdsParameter oParm2 = new AdsParameter();
oParm2.Value = 3;
oParm2.DbType = DbType.Int32;

oCmd.Parameters.Add(oParm1);
oCmd.Parameters.Add(oParm2);

I then proceed with creating the connection, open and then
execute. I get the following error message back.

"Error 7200: AQE Error: State = 07002; NativeError =
2141; [iAnywhere Solutions][Advantage SQL Engine]Parameter
missing AdsCommand query execution failed."


I have the two "?" place-holders for the parameters and have
added two parameters to the Command object. If I do the
exact same process with 1 parameter, I would get a result
back no problem... Again, hopefully something simple and
engine specific.


Don Posted on 2009-11-02 13:30:37.0Z
Sender: 51dc.4aeedeb0.1804289383@sybase.com
From: Don
Newsgroups: ianywhere.public.general
Subject: Re: Parameter missing, query failed
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4aeedefd.51e8.1681692777@sybase.com>
References: <4aeed9df.50f9.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Nov 2009 05:30:37 -0800
X-Trace: forums-1-dub 1257168637 10.22.241.41 (2 Nov 2009 05:30:37 -0800)
X-Original-Trace: 2 Nov 2009 05:30:37 -0800, 10.22.241.41
Lines: 45
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7789
Article PK: 6824

Never mind... After finding some OTHER documentation, I
found about the NAMED parameters using :NameOfParm and it
appears to be working now... Can't use the "?"
place-holder.

> Hi all, hopefully a simple answer. I'm just getting
> started and running into a roadblock. I've been doing SQL
> for years, and understand the principles of Parameters vs
> SQL-Injection and applied with other back-ends.
>
> I'm using C#.Net and going against Advantage Local Server,
> created a database, added a new table. I'm trying to do a
> simple query with 2 parameters and have as follows...
>
>
>
> AdsCommand oCmd = new AdsCommand("SELECT A1.MSLID FROM
> MyTable A1 WHERE A1.Field1 = ? AND A1.Field2 = ? ");
>
> AdsParameter oParm1 = new AdsParameter();
> oParm1.Value = "myvalue";
> oParm1.DbType = DbType.String;
>
> AdsParameter oParm2 = new AdsParameter();
> oParm2.Value = 3;
> oParm2.DbType = DbType.Int32;
>
> oCmd.Parameters.Add(oParm1);
> oCmd.Parameters.Add(oParm2);
>
> I then proceed with creating the connection, open and then
> execute. I get the following error message back.
>
> "Error 7200: AQE Error: State = 07002; NativeError =
> 2141; [iAnywhere Solutions][Advantage SQL
> Engine]Parameter missing AdsCommand query execution
> failed."
>
>
> I have the two "?" place-holders for the parameters and
> have added two parameters to the Command object. If I do
> the exact same process with 1 parameter, I would get a
> result back no problem... Again, hopefully something
> simple and engine specific.