Re: how to select or update data when column name has space

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: haiwen (haiwen_at_discussions.microsoft.com)
Date: 10/12/04


Date: Tue, 12 Oct 2004 12:15:02 -0700

Hi, thanks for your replies,

if I use:

select companyID from
or
select * from

it will work.

My dataset is a new empty dataset.

but if I use
select [company name] from

I will get the error information, it seems the command doesn't support []

Any idea?

Because I don't want to select all of columns and use the index, it is a
huge table.

Thanks a lot.

haiwen

"Eric Renken" wrote:

> That error sounds like your datatset that you are filling with the
> adapter.Fill(ds) doesn't allow NULLS in one of the columns and one of your
> columns is returning null. Make sure that the dataset column "Company Name"
> with a space exists. It might not be exactly the same name so it is
> inserting nulls into it for every Company ID.
>
> --
> Eric Renken
> Demiuirge Software LLC
> http://www.demiurge.us
>
>
> "haiwen" <haiwen@discussions.microsoft.com> wrote in message
> news:F6B61208-D59B-426F-AF3A-0397FF3B562F@microsoft.com...
> > Hello, Ryan:
> >
> > Thanks for your reply. I used it, such as:
> > s="select [Company name],CompanyID from companies order by CompanyID
> > asc";
> > OleDbDataAdapter adapter=new OleDbDataAdapter(s,con);
> >
> > adapter.Fill(ds);
> >
> > But I always get follow exception:
> >
> > System.Data.OleDb.OleDbException: No value given for one or more required
> > parameters.
> >
> > what's wrong I have done?
> > Sincerely,
> >
> > haiwen
> > "W.G. Ryan eMVP" wrote:
> >
> >> use [Company Name]
> >>
> >> --
> >> W.G. Ryan, MVP
> >>
> >> www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
> >> "haiwen" <haiwen@discussions.microsoft.com> wrote in message
> >> news:9169E853-AB4A-42DE-BE55-17C8C986FBD0@microsoft.com...
> >> > Hello, everyone:
> >> >
> >> > I am writing an ado.net componet in c# to fetch data from MS Acess
> >> database.
> >> >
> >> > I got a problem is some table has column with space, such as "company
> >> name",
> >> >
> >> > Could anyone tell me how to select this kind of column?
> >> >
> >> > sincerely,
> >> >
> >> > haiwen
> >>
> >>
> >>
>
>
>