Decker - Unfortunately asssigning names did not work. I am still getting the error:
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to join.How can I cast a real to a string or a real to an integer in the Linq expression?
RDowdall
Member
361 Points
215 Posts
How to handle a field data type mismatch in linq?
Nov 07, 2012 05:38 PM|LINK
var qq = from qu in mydb.qualities join qc in mydb.quality_codes on new { qu.quality_data_type, qu.quality_code } equals new { quality_data_type = qc.quality_data_type , quality_code = qc.quality_code1 } join ien in mydb.ing_eco_notes on new {qu.request_id_rcv, qu.request_line_rcv, qu.req_sequence_rcv } equals new { request_id_rcv = ien.request_id,request_line_rcv = ien.request_line, req_sequence_rcv = ien.req_line_sequence} where qu.request_id_rcv == Request.QueryString["rma"].ToString().Trim() where qu.request_line_rcv.ToString() == Request.QueryString["line"].ToString() where qu.req_sequence_rcv.ToString() == Request.QueryString["seq"].ToString() orderby qu.created_dt select new { qc.description, text = qu.text == null ? "" : qu.text, qu.repair_dt, qu.quality_data_type, quality_code = qu.quality_code.Trim(), request_qa_ids = qu.request_id_rcv + "^" + qu.request_line_rcv + "^" + qu.req_sequence_rcv + "^" + Convert.ToInt32(qu.qa_sequence).ToString() };Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to handle a field data type mismatch in linq?
Nov 08, 2012 06:10 AM|LINK
Hi,
I think you should format all of your codes like this below by adding anoymous properties' names to them:
var qq = from qu in mydb.qualities join qc in mydb.quality_codes on new { qu.quality_data_type, qu.quality_code } equals new { quality_data_type = qc.quality_data_type , quality_code = qc.quality_code1 } join ien in mydb.ing_eco_notes on new {RequestId=qu.request_id_rcv, LineRCV=qu.request_line_rcv, SequenceRCV=qu.req_sequence_rcv } equals new { request_id_rcv = ien.request_id,request_line_rcv = ien.request_line, req_sequence_rcv = ien.req_line_sequence} where qu.request_id_rcv == Request.QueryString["rma"].ToString().Trim() where qu.request_line_rcv.ToString() == Request.QueryString["line"].ToString() where qu.req_sequence_rcv.ToString() == Request.QueryString["seq"].ToString() orderby qu.created_dt select new { qc.description, text = qu.text == null ? "" : qu.text, qu.repair_dt, qu.quality_data_type, quality_code = qu.quality_code.Trim(), request_qa_ids = qu.request_id_rcv + "^" + qu.request_line_rcv + "^" + qu.req_sequence_rcv + "^" + Convert.ToInt32(qu.qa_sequence).ToString() };RDowdall
Member
361 Points
215 Posts
Re: How to handle a field data type mismatch in linq?
Nov 09, 2012 03:29 PM|LINK
Thank-you very much
RDowdall
Member
361 Points
215 Posts
Re: How to handle a field data type mismatch in linq?
Nov 09, 2012 07:48 PM|LINK
Decker - Unfortunately asssigning names did not work. I am still getting the error: The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to join. How can I cast a real to a string or a real to an integer in the Linq expression?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to handle a field data type mismatch in linq?
Nov 10, 2012 01:18 AM|LINK
Hi,
Try to convert them into the same type (such as a string type):
var qq = from qu in mydb.qualities join qc in mydb.quality_codes on new {quality_data_type = qu.quality_data_type.ToString(), quality_code=qu.quality_code.ToString() } equals new { quality_data_type = qc.quality_data_type.ToString() , quality_code = qc.quality_code1.ToString() } join ien in mydb.ing_eco_notes on new {RequestId=qu.request_id_rcv.ToString(), LineRCV=qu.request_line_rcv.ToString(), SequenceRCV=qu.req_sequence_rcv.ToString() } equals new { request_id_rcv = ien.request_id.ToString(),request_line_rcv = ien.request_line.ToString(), req_sequence_rcv = ien.req_line_sequence.ToString()} where qu.request_id_rcv == Request.QueryString["rma"].ToString().Trim() where qu.request_line_rcv.ToString() == Request.QueryString["line"].ToString() where qu.req_sequence_rcv.ToString() == Request.QueryString["seq"].ToString() orderby qu.created_dt select new { qc.description, text = qu.text == null ? "" : qu.text, qu.repair_dt, qu.quality_data_type, quality_code = qu.quality_code.Trim(), request_qa_ids = qu.request_id_rcv + "^" + qu.request_line_rcv + "^" + qu.req_sequence_rcv + "^" + Convert.ToInt32(qu.qa_sequence).ToString() };