Hi all,

I have two tables:

CREATE TABLE [SpatialApplications] (
        [ApplicationId] [int] IDENTITY (1, 1) NOT NULL ,
        [CRN] [char] (8) COLLATE Latin1_General_CI_AS NOT NULL ,
        [SRN] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
        [CaseId] [int] NULL ,
        [EditStatusId] [int] NULL ,
) ON [PRIMARY]

CREATE TABLE [AppAtbs] (
        [Id] [int] NOT NULL ,
        [CRN] [char] (8) COLLATE Latin1_General_CI_AS NOT NULL ,
        [EOIReceived] [datetime] NULL ,
) ON [PRIMARY]

(PK on SpatialApplication is ApplicationId, while PK on AppAtbs is Id)

A SpatialApplications record has many AppAtbs records.

In my (C#) AppAtb class, I've got the relationship set up as

        private SpatialApplication _SpatialApplication;
        [BelongsTo("CRN")]
        public SpatialApplication SpatialApplication
        {
            get { return _SpatialApplication; }
            set { _SpatialApplication = value; }
        }

and in the SpatialApplication class:

        private IList<CAP_AppAtb> _CAP_AppAtbs;
        [HasMany]
        private IList<CAP_AppAtb> CAP_AppAtbs
        {
            get { return _CAP_AppAtbs; }
            set { _CAP_AppAtbs = value; }
        }


When I run the application, I'm getting the error "Syntax error
converting the varchar value 'A0000001' to a column of data type int."
when retrieving SpatialApplication records and their AppAtbs records.

The full logged SQL is:

SQL: SELECT cap_appatb0_.CRN as CRN__1_, cap_appatb0_.Id as Id1_,
cap_appatb0_.Id as Id1_0_, cap_appatb0_.CRN as CRN1_0_,
cap_appatb0_.EOIReceived as EOIRecei3_1_0_, cap_appatb0_.AppPackSent
as AppPackS4_1_0_, cap_appatb0_.AppReceived as AppRecei5_1_0_,
cap_appatb0_.NSAppPoints as NSAppPoi6_1_0_ FROM AppAtbs cap_appatb0_
WHERE cap_appatb0_.CRN=?

Copying this int SQL Query Analyzer and running it with an appropriate
CRN for the parameter placeholder works fine.

Can anyone enlighten me as to what is going on?

Thanks,

James

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to