LLBLGen 3.5
.net framework 4.0
C# windows application
LLBLgen run time framework
Dear Support team,
I am trying to convert date format in typed list based on example given in http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16740. But I get an error "An exception was caught during the execution of a retrieval query: Argument data type nvarchar is invalid for argument 3 of convert function.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception". If I remove the line billdate.SetExpression, it just works fine
public static DataTable returnGuestregistrationReverseload(string Date, string Id)
{
try
{
string regndate = string.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(Date).Date);
var guestregistration = new TlguestRegistrationTypedList();
EntityField billdate = GuestregnheaderFields.Regndate;
[b]billdate.SetExpression(new DbFunctionCall("CONVERT(VARCHAR, {0},{1})", new object[] { GuestregnheaderFields.Regndate,"103" }));
[/b]
IPredicateExpression filter =
new PredicateExpression(billdate == regndate)
.AddWithAnd(new FieldCompareValuePredicate(GuestregnheaderFields.Guestregnheaderid,
ComparisonOperator.Equal,
Id));
guestregistration.Fill(0, null, true, filter);
return guestregistration;
}
catch (Exception ex)
{
ErrorHandler.LogMessage(ex.Message + ex.StackTrace);
throw;
}
}