Using other samples from this website, I have tried many combinations of field value assignment to update a split job’s comment fields from the original job’s comment fields. The error message received is “CS0103 - The name ‘jhn’ does not exist in the current context”. It also repeats for the jho (original job row).
I have tried the following:
-
newJob.jhn.PartMfgComment_c = origJob.jho.PartMfgComment_c;
Resulting errors:
CS1061 ‘IQueryable’ does not contain a definition for ‘jhn’ and no extension method ‘jhn’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?)
CS1061 ‘IQueryable’ does not contain a definition for ‘jho’ and no extension method ‘jho’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?) -
newJob.PartMfgComment_c = origJob.PartMfgComment_c;
Resulting errors:
CS1061 ‘IQueryable’ does not contain a definition for ‘PartMfgComment_c’ and no extension method ‘PartMfgComment_c’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?)
CS1061 ‘IQueryable’ does not contain a definition for ‘PartMfgComment_c’ and no extension method ‘PartMfgComment_c’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?)
Here’s the custom code:
//Erp.Tables.JobHead JobHead;
using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
// Get the Orignal Job
var origJob = (from jho in Db.JobHead.With(LockHint.NoLock)
where jho.Company == callContextClient.CurrentCompany
&& jho.JobNum == ipJobNum
select jho);
if (origJob != null)
{
//Get the newly created (split) Job
var newJob = (from jhn in Db.JobHead.With(LockHint.UpdLock)
where jhn.Company == callContextClient.CurrentCompany
&& jhn.JobNum == ipNewJobNum
select jhn);
if (newJob != null)
{ //jhn.PartRevDescription_c = jho.PartRevDescription_c;
//newJob.jhn.PartMfgComment_c = origJob.jho.PartMfgComment_c;
//newJob.PartMfgComment_c = origJob.PartMfgComment_c;
jhn.PartMfgComment_c = jho.PartMfgComment_c;
}
Db.Validate();
txscope.Complete();
}
}