Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Wed, 23 Apr 2008 08:22:42 +1200,    group: microsoft.public.sqlserver.ce        back       


VS2008 and Compact Server 3.5   
Hi,
Oops, accidentally posted this to the C# group so apologies for cross
posting.

VS2008 IDE Desktop app.

Anybody out there deploying this db?

I am finding a strange problem with column names.

I am using an SQLCeCommand to create a datareader.
I have a where clause that is refusing some of the column names.
Saying the column name is not valid.
The columns are visible in Server explorer.

It seems to be column names that where added later on in the tables
design.
example of problem
"select * from unit where parent_id = 1"  //fails, parent_id was added
after initial table construction

"select * from unit where id = 1"  //works id was part of table
initial construction


A third party Database console has no problem running the queries

Code:

 SqlCeConnection conn = new SqlCeConnection(mstrConnectionString);
//mstrConnection just has  "DataSource = myFullPath\mydatabase.sdf

                conn.Open();
                string sql = "select * from unit where parent_id = 1";
                SqlCeCommand cmd = new SqlCeCommand(sql,conn);
                SqlCeDataReader r = cmd.ExecuteReader();  //DROPS DEAD
HERE with 'invalid column'

Appreciate any thoughts on the above.

Thanks 
Bob
date: Wed, 23 Apr 2008 08:22:42 +1200   author:   bob

Re: VS2008 and Compact Server 3.5   
Are you sure the database at the location where you're looking does have 
that column name? Can you execute any command on that connection? If you 
execute the query select count(*) from information_schema.columns where 
column_name = 'parent_id', do you get something greater than 0?

Ginny

"bob"  wrote in message 
news:4qhs04tiidd62cuuamse1fsq9dv2n14784@4ax.com...
> Hi,
> Oops, accidentally posted this to the C# group so apologies for cross
> posting.
>
> VS2008 IDE Desktop app.
>
> Anybody out there deploying this db?
>
> I am finding a strange problem with column names.
>
> I am using an SQLCeCommand to create a datareader.
> I have a where clause that is refusing some of the column names.
> Saying the column name is not valid.
> The columns are visible in Server explorer.
>
> It seems to be column names that where added later on in the tables
> design.
> example of problem
> "select * from unit where parent_id = 1"  //fails, parent_id was added
> after initial table construction
>
> "select * from unit where id = 1"  //works id was part of table
> initial construction
>
>
> A third party Database console has no problem running the queries
>
> Code:
>
> SqlCeConnection conn = new SqlCeConnection(mstrConnectionString);
> //mstrConnection just has  "DataSource = myFullPath\mydatabase.sdf
>
>                conn.Open();
>                string sql = "select * from unit where parent_id = 1";
>                SqlCeCommand cmd = new SqlCeCommand(sql,conn);
>                SqlCeDataReader r = cmd.ExecuteReader();  //DROPS DEAD
> HERE with 'invalid column'
>
> Appreciate any thoughts on the above.
>
> Thanks
> Bob

-- 

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management
date: Tue, 22 Apr 2008 17:12:31 -0400   author:   Ginny Caughey MVP

Re: VS2008 and Compact Server 3.5   
Hi Ginny,
Thanks for your reply.
Given that no else has struck this problem I must be doing something
wrong.
Unfortunately I have moved the DAL back to Access. 
(Now targeting Framework 2.0 for the desktop version not because of
this problem)
When the app migrates onto a hand held I'll revisit the  problem.
regards
Bob
On Tue, 22 Apr 2008 17:12:31 -0400, "Ginny Caughey MVP"
 wrote:

>Are you sure the database at the location where you're looking does have 
>that column name? Can you execute any command on that connection? If you 
>execute the query select count(*) from information_schema.columns where 
>column_name = 'parent_id', do you get something greater than 0?
>
>Ginny
>
>"bob"  wrote in message 
>news:4qhs04tiidd62cuuamse1fsq9dv2n14784@4ax.com...
>> Hi,
>> Oops, accidentally posted this to the C# group so apologies for cross
>> posting.
>>
>> VS2008 IDE Desktop app.
>>
>> Anybody out there deploying this db?
>>
>> I am finding a strange problem with column names.
>>
>> I am using an SQLCeCommand to create a datareader.
>> I have a where clause that is refusing some of the column names.
>> Saying the column name is not valid.
>> The columns are visible in Server explorer.
>>
>> It seems to be column names that where added later on in the tables
>> design.
>> example of problem
>> "select * from unit where parent_id = 1"  //fails, parent_id was added
>> after initial table construction
>>
>> "select * from unit where id = 1"  //works id was part of table
>> initial construction
>>
>>
>> A third party Database console has no problem running the queries
>>
>> Code:
>>
>> SqlCeConnection conn = new SqlCeConnection(mstrConnectionString);
>> //mstrConnection just has  "DataSource = myFullPath\mydatabase.sdf
>>
>>                conn.Open();
>>                string sql = "select * from unit where parent_id = 1";
>>                SqlCeCommand cmd = new SqlCeCommand(sql,conn);
>>                SqlCeDataReader r = cmd.ExecuteReader();  //DROPS DEAD
>> HERE with 'invalid column'
>>
>> Appreciate any thoughts on the above.
>>
>> Thanks
>> Bob
date: Fri, 25 Apr 2008 08:16:24 +1200   author:   bob

RE: VS2008 and Compact Server 3.5   
I don't know if you're using LINQ but I got burned by this once. I renamed 
the field in the context but the "Source" property was still pointing to the 
old column name. That caused my invalid column error.  

Tod


"bob" wrote:

> Hi,
> Oops, accidentally posted this to the C# group so apologies for cross
> posting.
> 
> VS2008 IDE Desktop app.
> 
> Anybody out there deploying this db?
> 
> I am finding a strange problem with column names.
> 
> I am using an SQLCeCommand to create a datareader.
> I have a where clause that is refusing some of the column names.
> Saying the column name is not valid.
> The columns are visible in Server explorer.
> 
> It seems to be column names that where added later on in the tables
> design.
> example of problem
> "select * from unit where parent_id = 1"  //fails, parent_id was added
> after initial table construction
> 
> "select * from unit where id = 1"  //works id was part of table
> initial construction
> 
> 
> A third party Database console has no problem running the queries
> 
> Code:
> 
>  SqlCeConnection conn = new SqlCeConnection(mstrConnectionString);
> //mstrConnection just has  "DataSource = myFullPath\mydatabase.sdf
> 
>                 conn.Open();
>                 string sql = "select * from unit where parent_id = 1";
>                 SqlCeCommand cmd = new SqlCeCommand(sql,conn);
>                 SqlCeDataReader r = cmd.ExecuteReader();  //DROPS DEAD
> HERE with 'invalid column'
> 
> Appreciate any thoughts on the above.
> 
> Thanks 
> Bob
>
date: Mon, 12 May 2008 19:05:01 -0700   author:   tod_syncor

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us