can't pass parameters via EF to Oracle Database
as the the title implies, I got an "ORA-00932: inconsistent datatypes: expected - got NCLOB"
when passing a string value with linq through the Entity Framework.
I'm using VS 2010, ODAC 2011 with EF support.
I tried passing the value itself (no variable but directly using the "") and it just worked fine, I've tested my variable and yeah it is fine and it provides the right value. I guess it is a bug somewhere and the string value reach Oracle wrongly, anyone faced this? Any work arround?
Thanks in a开发者_运维技巧dvance
public ObservableCollection<String> getCarModels(string carName)
{
carContext = new Entities();
carModelNamesList = new ObservableCollection<string>();
var result = from d in carContext.CARs
where d.NAME == carName
select d;
foreach (CAR d in result)
{
string f = d.MODEL;
carModelNamesList.Add(f);
}
return carModelNamesList;
}
guys , sorry it is my bad , the variable is null when the event occured , in my way of testing was using another event , so the variable is having the right value when the my test event occured and having null when the acctual event occured , I hope this may help someone.
I got the same error when I tried to check a varchar2 against a String.Empty value in my Where clause. This caused me a lot of lost time trying to figure out what's going on. I guess you got to be careful on what you're conditions looks like because Oracle can be very picky!
I also wanted to add, our team just got this same error and it was resolved by refreshing the Entity Model from the database. I had modified the designer to make a column nullable but I guess that wasn't the cleanest way to do it since it "confused" the EF engine. After refreshing from the database it coded the way it wanted to see a nullable column in the designer code and we were good after that.
Of course, we have no idea what was really going on behind the EF curtain and why this would trip it up. Seems like a bug. Why shouldn't we be able to adjust a column's attributes in the designer directly?
精彩评论