PC Review


Reply
Thread Tools Rate Thread

# char in field name causing error

 
 
CSharpner
Guest
Posts: n/a
 
      14th May 2004
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
 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      14th May 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Brad Allison
Guest
Posts: n/a
 
      14th May 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      14th May 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
CSharpner
Guest
Posts: n/a
 
      21st May 2004
Thanks! I knew it had to be something simple like that!.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:<(E-Mail Removed)>...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

 
Reply With Quote
 
CSharpner
Guest
Posts: n/a
 
      21st May 2004
Thanks!

"Brad Allison" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

 
Reply With Quote
 
CSharpner
Guest
Posts: n/a
 
      21st May 2004
"Bob Lehmann" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> <<<<
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to permanently delete char char char char style in MS Word? =?Utf-8?B?Q3Jpcw==?= Microsoft Word Document Management 6 12th Jun 2011 09:47 PM
Interop: C++ char * in C# causing MissingMethodException on Compac =?Utf-8?B?SmltIExpZGRlbGw=?= Microsoft Dot NET Compact Framework 0 25th Apr 2006 09:37 PM
error LNK2019: unresolved external symbol "public: static class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > danip Microsoft VC .NET 0 5th Dec 2005 10:01 AM
How do I limit input-length (char by char) into a Memo Field =?Utf-8?B?TkpT?= Microsoft Access VBA Modules 2 17th Nov 2004 04:29 PM
char ; in file name is causing trouble Howard Sartori Windows XP General 2 3rd Apr 2004 12:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:51 PM.