-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Using classes:
public class AM112U {
[Column] public int Id { get; set; }
[Column] public string? NormalizedName { get; set; }
[Column] public string? NormalizedEmailAddress { get; set; }
[Column] public int? ImpAM112Id { get; set; }
public int AM114Id { get; set; }
public AM114U? AM114U { get; set; }
}
public class AM114U {
[Column] public int Id { get; set; }
[Column] public string? NormalizedName { get; set; }
public List<AM112U>? AM112UList { get; set; }
}
When I try to run code:
var builder = new LinqToDbConnectionOptionsBuilder();
var connString = appSettings.ConnectionStrings.TestDB2iSeries;
var dataProvider = new DB2iSeriesDataProvider(DB2iSeriesProviderType.Odbc);
builder.UseConnectionString(dataProvider, connString);
var db = new DataConnection(new LinqToDbConnectionOptions(builder));
var fmb = db.MappingSchema.GetFluentMappingBuilder();
fmb.Entity<AM112U>().Association(x => x.AM114U, (x, y) => x.AM114Id == y.Id);
fmb.Entity<AM114U>().Association(x => x.AM112UList, (y, x) => x.AM114Id == y.Id);
try {
var testName = "TEST";
var testList = (from x in db.GetTable<AM112U>()
where x.AM114U.NormalizedName == testName
select new {
Id = x.Id,
Name = x.NormalizedName ?? string.Empty,
EmailAddress = x.NormalizedEmailAddress,
}).ToList();
} catch(Exception ex) {
throw new Exception(db.LastQuery + " " + ex.Message);
}
I get exception:
Exception:
SELECT x.Id, Coalesce(x.NormalizedName, ''), x.NormalizedEmailAddress
FROM AM112U x
LEFT JOIN AM114U T500 ON x.AM114Id = T500.Id
WHERE T500.NormalizedName = CAST(? AS NCLOB)
ERROR [42S02] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0204 - NCLOB in *LIBL type *SQLUDT not found.
It should not require any cast, just use a parameter.
Why is my string being cast as NCLOB when the variable testName is a string?
Why isn't a parameter being used for testName string variable?
Metadata
Metadata
Assignees
Labels
No labels