"undefined function call" when using function in a DataSet
I have a DataSet
in UserAdmin.xsd
with many DataTable
s. Most of the data come directly from stored procedures. However for one of the tables, I would like to add another column which uses a C# function defined in another file.
I put for the expression for that column: Helper.ObtainUserInfo(user_nm, "displayname");
but that gives me an error "undefined function call".
Helper.cs
is located under App_Code/Common/
and the namespace is COM.A.B.C
. UserAd开发者_C百科min.xsd
is located under App_Code/
.
How can I access the function ObtainUserInfo()
? Is there something like a using
keyword that I could use?
You cannot use DataColumn.Expression
to call a .NET-Method to obtain a value. You must refer a column in this table or one of the parent/child tables to calculate the value. For more informations on what you can('t) do with Expressions
look here: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression%28v=VS.100%29.aspx
Instead of using a method or an expression, i would recommend to do this with SQL whenever possible.
if You provide your code, then it would be very helpful to solve your problem, anyway assuming your problem i have solution, i hope it may helped you
You can open the Code File Which Contain ObtainUserInfo() Function, then You can Refer that Class Name, in other File. For eg : If you hav solution Named WebApplication1, inside that if you have users class, in that users class, ObtainUserinfo() function is defined, then You Have to Use statement like this,
Using WebApplication1.Users
精彩评论