I'm using DB2 for my database server. I'm trying to configure a
DataAtapter, but after selecting the fields I need, I get the error,
"unable to parse query text". I know that the cause is a field name
with the # (pound character) in the name, like "Part#".

Changing the field name is, unfortunately, not an option. How the
heck are you supposed to query a table like that?

TIA

Re: # char in field name causing error by Miha

Miha
Fri May 14 09:06:26 CDT 2004

Did you try to put the field in square brackets?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"CSharpner" <google@easiesttoremember.com> wrote in message
news:30383b28.0405140552.4ac25217@posting.google.com...
> I'm using DB2 for my database server. I'm trying to configure a
> DataAtapter, but after selecting the fields I need, I get the error,
> "unable to parse query text". I know that the cause is a field name
> with the # (pound character) in the name, like "Part#".
>
> Changing the field name is, unfortunately, not an option. How the
> heck are you supposed to query a table like that?
>
> TIA



Re: # char in field name causing error by Brad

Brad
Fri May 14 15:12:18 CDT 2004

TIA,

If you are using an AS400 system (DB2) like I am, here is a sample SELECT
string from one of my apps:

SELECT CMNAME, CMADR1, CMCITY, CMST, CMZIP5, CMPHON, "CMCUS#", CMMAGC,
CMADR2, CMCONT, CMFAX
FROM QS36F.ARCUST
WHERE ("CMCUS#" = ?)

As you can see the field with the pound sign (#) is surrounded with
quotation marks. Now, this select statement was generated by the Command
Wizard.

Hope this helps.

Brad


"CSharpner" <google@easiesttoremember.com> wrote in message
news:30383b28.0405140552.4ac25217@posting.google.com...
> I'm using DB2 for my database server. I'm trying to configure a
> DataAtapter, but after selecting the fields I need, I get the error,
> "unable to parse query text". I know that the cause is a field name
> with the # (pound character) in the name, like "Part#".
>
> Changing the field name is, unfortunately, not an option. How the
> heck are you supposed to query a table like that?
>
> TIA



Re: # char in field name causing error by Bob

Bob
Fri May 14 15:21:39 CDT 2004

<<<<
How the heck are you supposed to query a table like that?
>>>>

Design the DB correctly to begin with? :>)

Fieldnames should never contain anything but alpha-numeric values & the
underscore character. Even the numeric can be dicey.

However, since you can't unshoot the gun, wrap the field name in [] -
[Part#] - in your queries.

Bob Lehmann

"CSharpner" <google@easiesttoremember.com> wrote in message
news:30383b28.0405140552.4ac25217@posting.google.com...
> I'm using DB2 for my database server. I'm trying to configure a
> DataAtapter, but after selecting the fields I need, I get the error,
> "unable to parse query text". I know that the cause is a field name
> with the # (pound character) in the name, like "Part#".
>
> Changing the field name is, unfortunately, not an option. How the
> heck are you supposed to query a table like that?
>
> TIA



Re: # char in field name causing error by google

google
Fri May 21 15:58:00 CDT 2004

Thanks! I knew it had to be something simple like that!.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:<e0wjizbOEHA.3124@TK2MSFTNGP12.phx.gbl>...
> Did you try to put the field in square brackets?
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
> "CSharpner" <google@easiesttoremember.com> wrote in message
> news:30383b28.0405140552.4ac25217@posting.google.com...
> > I'm using DB2 for my database server. I'm trying to configure a
> > DataAtapter, but after selecting the fields I need, I get the error,
> > "unable to parse query text". I know that the cause is a field name
> > with the # (pound character) in the name, like "Part#".
> >
> > Changing the field name is, unfortunately, not an option. How the
> > heck are you supposed to query a table like that?
> >
> > TIA

Re: # char in field name causing error by google

google
Fri May 21 15:59:30 CDT 2004

Thanks!

"Brad Allison" <ballison@ukcdogs.com> wrote in message news:<O7ELRAfOEHA.3088@TK2MSFTNGP09.phx.gbl>...
> TIA,
>
> If you are using an AS400 system (DB2) like I am, here is a sample SELECT
> string from one of my apps:
>
> SELECT CMNAME, CMADR1, CMCITY, CMST, CMZIP5, CMPHON, "CMCUS#", CMMAGC,
> CMADR2, CMCONT, CMFAX
> FROM QS36F.ARCUST
> WHERE ("CMCUS#" = ?)
>
> As you can see the field with the pound sign (#) is surrounded with
> quotation marks. Now, this select statement was generated by the Command
> Wizard.
>
> Hope this helps.
>
> Brad
>
>
> "CSharpner" <google@easiesttoremember.com> wrote in message
> news:30383b28.0405140552.4ac25217@posting.google.com...
> > I'm using DB2 for my database server. I'm trying to configure a
> > DataAtapter, but after selecting the fields I need, I get the error,
> > "unable to parse query text". I know that the cause is a field name
> > with the # (pound character) in the name, like "Part#".
> >
> > Changing the field name is, unfortunately, not an option. How the
> > heck are you supposed to query a table like that?
> >
> > TIA

Re: # char in field name causing error by google

google
Fri May 21 16:01:30 CDT 2004

"Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message news:<efAS6EfOEHA.808@tk2msftngp13.phx.gbl>...
> <<<<
> How the heck are you supposed to query a table like that?
> >>>>
>
> Design the DB correctly to begin with? :>)
>
> Fieldnames should never contain anything but alpha-numeric values & the
> underscore character. Even the numeric can be dicey.

Trust me! If I had any say so, there'd be quite a few differences! :)
I can safely wash my hands of any responsibility in that department.

> However, since you can't unshoot the gun, wrap the field name in [] -
> [Part#] - in your queries.

Thanks Bob!

> Bob Lehmann
>
> "CSharpner" <google@easiesttoremember.com> wrote in message
> news:30383b28.0405140552.4ac25217@posting.google.com...
> > I'm using DB2 for my database server. I'm trying to configure a
> > DataAtapter, but after selecting the fields I need, I get the error,
> > "unable to parse query text". I know that the cause is a field name
> > with the # (pound character) in the name, like "Part#".
> >
> > Changing the field name is, unfortunately, not an option. How the
> > heck are you supposed to query a table like that?
> >
> > TIA