Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Ling to SQL Generic ExcuteMethodCall with parameters

Ling to SQL Generic ExcuteMethodCall with parameters

Scheduled Pinned Locked Moved LINQ
csharpsharepointdatabasedotnetsysadmin
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 4382232
    wrote on last edited by
    #1

    Hi, I would like help with writing a generic ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters) that can take any number of input parameters and always 3 output parameters or is there another way to read output parameters because the help on ExecuteMethod call says "This API supports the .NET Framework infrastructure and is not intended to be used directly from your code." public class MyClass { ..... [Function(Name = "sp_Info_Change")] public bool Change() { int inVal1 = 1; string inVal2 = "Test"; int outVal1 = 0; string outVal2 = ""; string outVal3 = ""; return MyDataClass.ExecuteMethod(this, (MethodInfo)MethodInfo.GetCurrentMethod(), inVal1, inVal2, ref outVal1, ref outVal2, ref outVal3); } ..... } public class MyDataContextClass: DataContext { ..... public bool ExecuteMethod(object tableClass, MethodInfo method, [Parameter(DbType = "Int")] int inVal1, [Parameter(DbType = "Varchar(25)")] string inVal2, [Parameter(DbType = "Int")] ref int outVal1, [Parameter(DbType = "Varchar(500)"] ref string outVal2, [Parameter(DbType = "Varchar(25)")] ref string outVal3) { bool result = false; IExecuteResult xresult = ExecuteMethodCall(tableClass, method, inVal1, inVal2, outVal1, outVal2, outVal3); outVal1 = Convert.ToInt32(xresult.GetParameterValue(2).ToString()); outVal2 = xresult.GetParameterValue(3).ToString(); outVal3 = xresult.GetParameterValue(4).ToString(); if (outVal1 == 1) { result = true; } return result; } } Any help would be much appreciated Thank you

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups