Select Class Cast Function

The Cast function in select class is not working, second parameter 'DBDataValueType' gets error as 'Error   CS1503   Argument 2: cannot convert from 'System.Guid' to 'Terrasoft.Core.DBDataValueType'   Terrasoft.Configuration.Dev'.

 

var SelQuery = new Select(UserConnection)
.Column(Func.Cast("UsrName", DBDataValueType.TextDataValueTypeUId)).As("UsrName")
.From("UsrTableName") as Select;
 
var SelRecord = SelQuery.ExecuteScalar<string>();

 

Like 0

Like

2 comments

Hi there, 

 

It seems that the error may be hidden in this line: 

.Column(Func.Cast("UsrName", DBDataValueType.TextDataValueTypeUId))

 

Please try to use the code below as an example: 

var textDataValueType = new TextDataValueType(new DataValueTypeManager()) {
   Name = "Text"
};
var SelQuery = new Select(UserConnection)
   .Column(Func.Cast("Name", textDataValueType)).As("Name")
   .From("Contact") as Select;
var SelRecord = SelQuery.ExecuteScalar&lt;string&gt;();

 

Regards,

Anastasiia

Anastasiia Markina,

 

Thanks for code, Now its working.

Show all comments