My goal is to return a C#
SQLDataReader
object from a C#
function into a JavaScript
.
In the JavaScript
part I would like to read String-Values from the DataReader.
Is this possible?
This is how I tested:
var tools = Tools.GetExtension("LoadTheNETAssembly");
reader = tools.ExecProcedure("exec Loc.dbo.spASTVSwitch '" + sExtension + "', '" + sChannel + "'");
So I called the "ExecProcedure" Function in the C#
Code.
This works, but I do not know how to handle the returned SQLDataReader.
In the past I returned a ADODB-Connection object from a Delphi-Function into JavaScript
.
This worked perfectly and I would like to replace the Delphi-Part by C#
.
I have made a app in winforms where I made all pages in static html,css,javascript. I need to bind my javascript based list from the app where my whole backend code in c#. I simply done ComVisibleAttribute(True) on the page. My C# code expose a StringBuilder that have all the result.
I simply call .ToString() from javascript on that object and I can see the response in javacript. Same time my Breakpoint hits in C# (.cs code) so this is how I get my work done as I want.
In your situation you are calling C# code from your JavaScript code. You can expose every object (which is public) to the Javascript Code. For example read this article https://www.codeproject.com/Articles/35373/VB-NET-C-and-JavaScript-communication
You can call your C# object from Javascript something like this
window.external.reader.MyFunction()
Remember that object that you want to use in c# should be publicly accessible and must be static.