This question is locked. New answers and comments are not allowed.
Hi,
I'm a bit stuck with a query which worked with entity framework but here in OpenAccess it doesn't do what I want. Maybe because I'm still a beginner. What I need is to get an ID of an existing entry to be inserted. The query is as follows:
This always ends with addResults.Substance_id with a value of 0 although it should be 1. subName is the name of the entry and the variable is correct.
There are two tables, results and substances. They are connected by a 1(substances) to many (results) relationship. I tried the same with the query below with the same result:
In the documentation I only found a solution to directly add a new item to the related table.
Ueli
I'm a bit stuck with a query which worked with entity framework but here in OpenAccess it doesn't do what I want. Maybe because I'm still a beginner. What I need is to get an ID of an existing entry to be inserted. The query is as follows:
addResults.Substance_id = mysqlhplc.Substances.Where(
Function
(p) p.Substance1 = subName).
Select
(
Function
(s) s.Id_substances).FirstOrDefault()
This always ends with addResults.Substance_id with a value of 0 although it should be 1. subName is the name of the entry and the variable is correct.
There are two tables, results and substances. They are connected by a 1(substances) to many (results) relationship. I tried the same with the query below with the same result:
Dim
subId as Substance=(From s in Substances
where s.substance1=subName
select s)
addresults.substance_id=subID.id_substances
In the documentation I only found a solution to directly add a new item to the related table.
Ueli