Hi, Jeff.
I added 'as object[]' to it and it worked like a charm!
Excellent. I wasn't sure what comPlusObject.Execute("a", "b", "c")
returned.
If it does not return an array, then you probably don't need the looping
constructs I provided. The following should work too.
object arrData = comPlusObject.Execute("a", "b", "c");
Response.Write(arrData);
You could also try:
Response.Write(comPlusObject.Execute("a", "b", "c"));
A minor issue I'm experiencing is the 'Console.WriteLine()' function
doesn't appear to be working. 'Response.Write()' works fine. Do you know
why this might be happening?
From your original post, I wasn't sure if you wanted to convert the original
ASP code to C#
a. ...and keep it as ASP code, or
b. ...use it in a non-web context.
...so I just left the commented code as a hint. If you're programming a web
page, then just use Response.Write and ignore Console.WriteLine.
Console.WriteLine is frequently used in console applications.
Hope that helps,
Damon
Visual C# IDE
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Jeff Johnson said:
Hi Damon,
I was getting an "Cannot implicitly convert type 'object' to 'object[]'"
error on the declaration line. I added 'as object[]' to it and it worked
like a charm!
Thanks very much for your reply. I've been stuck on this one for a while,
A minor issue I'm experiencing is the 'Console.WriteLine()' function doesn't
appear to be working. 'Response.Write()' works fine. Do you know why this
might be happening?
Jeff
Hi, Jeff.
Here are two options:
object[] arrData = comPlusObject.Execute("a", "b", "c");
for (int i = 0; i < arrData.Length; ++i)
{
//Response.Write(arrData
);
//Console.WriteLine(arrData);
//...etc....
}
...or:
object[] arrData = comPlusObject.Execute("a", "b", "c");
foreach (object datum in arrData)
{
//Response.Write(datum);
//Console.WriteLine(datum);
//...etc....
}
HTH,
Damon
Visual C# IDE
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
How would I convert this ASP code to C#?
arrData = comPlusObject.Execute("a", "b", "c")
for(i=0 to ubound(arrData))
response.write(arrData(i))
next
Thanks,
Jeff