Is there an equivalent vb.net eval function for vbscript eval

烈酒焚心 提交于 2019-12-25 06:38:23

问题


I want to execute the code that is passed as a string to my function, the code will be passed at runtime. This is an example code that may be passed as a string to my function.

p is a dataset, which is declared and has some values, this code is executed in a asp.net page

p.Tables(0).Rows(0)("disp_status") = "Approved by CEO";
p.Tables(0).Rows(0)("status") = "Approved";
Session("fnc") = "generate po";
Session("rec_id") = p.Tables(0).Rows(0)("IndexID");
Session("ord_ref")="PR No.";
Server.Execute("../rlm/mne_pr_form_f.asp"); 
p.Tables(0).Rows(0)("status") = "Order Raised" 
p.Tables(0).Rows(0)("disp_status") = "Order Raised"
p.Tables(0).Rows(0)("lock_record") = "Yes";
Session("fnc") = "";
Session("rec_id") = "";

回答1:


There's no Eval function as such, but depending on exactly what you want to do, you can do things like this using Reflection and here is a CodeProject article that includes a library to let you do this: Runtime Compilation (A .NET eval statement)



来源:https://stackoverflow.com/questions/4850522/is-there-an-equivalent-vb-net-eval-function-for-vbscript-eval

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!