Hi - I am wondering if anyone has seen this exception:
System.InvalidCastException: Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Devart.Data.Linq.Provider.DataProvider.a(String A_0, IList`1 A_1, IDbCommand& A_2)
at Devart.Data.Linq.r.a(MetaType A_0, n A_1, Object A_2, ModifiedMemberInfo[] A_3)
at Devart.Data.Linq.t.a(h A_0, Object A_1, ModifiedMemberInfo[] A_2)
at Devart.Data.Linq.i.a(e A_0)
at Devart.Data.Linq.i.d()
at Devart.Data.Linq.DataContext.SubmitChanges()
I've been beating my head against the desk for a day now. It gets thrown even though I am passing in values for everything in the DB. And other tables int the same database are able to update fine.
I'm using the most recent version of dotConnect and Entity Developer
Here is the general structure of my code.
The table I am trying to update:
CREATE TABLE table_catalog
(
id integer NOT NULL DEFAULT nextval('table_catalog_id_seq'::regclass),
common_name character varying(25) NOT NULL,
description character varying(256),
string_type_one character varying(512),
string_type_two character varying(64),
token timestamp without time zone NOT NULL DEFAULT timezone('UTC'::text, now()),
CONSTRAINT table_catalog_pkey PRIMARY KEY (id),
CONSTRAINT table_common_name_key UNIQUE (common_name)
)
And looking at the dbml i see this:
And the values that I am passing in are:
p1.Name: ID setting to value: 1 from value: 1
p1.Name: CommonName setting to value: "MyCommonName" from value: "MyCommonName"
p1.Name: Description setting to value: "This is a test description." from value: "This is a test description. - Blah"
p1.Name: StringTypeOne setting to value: "" from value: null
p1.Name: StringTypeTwo setting to value: "" from value: null
I can't for the life of me figure out why I am getting the Null object exception. Any help would be most appreciated. Thank you
unknown System.InvalidCastException.
Do you have the latest build of dotConnect for PostgreSQL? I have just tried to update the table_catalog and succeeded.
I used the following code:
Could you please post the code you used for update?
I used the following code:
Code: Select all
using (DataContext1.DataContext1 db = new DataContext1.DataContext1()) {
table_catalog tc = db.table_catalogs.First();
tc.description = "test3";
tc.string_type_one = "";
tc.string_type_two = "";
db.SubmitChanges();
}
-
- Posts: 5
- Joined: Thu 15 Jan 2009 22:51