Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / May 2008

Tip: Looking for answers? Try searching our database.

VS2008 and Compact Server 3.5

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bob - 22 Apr 2008 21:22 GMT
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 MVP - 22 Apr 2008 22:12 GMT
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

> Hi,
> Oops, accidentally posted this to the C# group so apologies for cross
[quoted text clipped - 37 lines]
> Thanks
> Bob

Signature

Ginny Caughey
Device Application Development MVP

www.wasteworks.com
Software for Waste Management

bob - 24 Apr 2008 21:16 GMT
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

>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
[quoted text clipped - 44 lines]
>> Thanks
>> Bob
tod_syncor - 13 May 2008 03:05 GMT
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

> Hi,
> Oops, accidentally posted this to the C# group so apologies for cross
[quoted text clipped - 37 lines]
> Thanks
> Bob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.