- Dan Harrel
- SnapObjects
- Tuesday, 8 December 2020 05:09 PM UTC
I'm building a web API in SnapDevelop using SQLModelMapper and ODBC, and this is all new to me so far. I have converted a PowerBuilder datawindow to the following (omitted Usings):
namespace MyApp.Models
{
[DataWindow("d_prt", DwStyle.Default)]
[Table("part")]
#region DwSelectAttribute
[DwSelect("select \r\n "
+"@(_COLUMNS_PLACEHOLDER_) \r\n "
+"from \r\n "
+"part p \r\n "
+"where \r\n "
+"p.prt_id=:a_prt_id")]
#endregion
[DwParameter("a_prt_id", typeof(double?))]
[DwKeyModificationStrategy(UpdateSqlStrategy.DeleteThenInsert)]
[UpdateWhereStrategy(UpdateWhereStrategy.KeyAndConcurrencyCheckColumns)]
public class D_Prt
{
[Key]
[Identity]
[DwColumn("p", "prt_id")]
public int Prt_Id { get; set; }
[ConcurrencyCheck]
[DwColumn("p", "prt_cd")]
public string Prt_Cd { get; set; }
[ConcurrencyCheck]
[DwColumn("p", "prt_nm")]
public string Prt_Nm { get; set; }
}
}
My Service class contains the following line which throws an error:
D_Prt d_prt = _dataContext.SqlModelMapper.Load<D_Prt>(prt_id).FirstOrDefault();
The error is:
OdbcException: ERROR [42S02] [SAP][ODBC Driver][SQL Anywhere]Correlation name 'p' not found
The correlation name is defined in the DwSelect attribute value, above. Is SQLModelMapper modifying my Select statement? If so, how can I see what it modifies it to? How can I get around this problem?
Thanks!
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.