M
mrgr8avill
Hello, all.
First off, I apologize for my ignorance. I am not used to working with non-variants, and it has been a LONG time since
I dealt with OOP.
I need to pass a string to a compiled method that requires an array of objects, like:
execute(string[],object[])
it was obviously created as an object because it was meant to accept input from the page form, but I want to send it
information from a datatable instead. Here's the relevant code:
---------------------
DataTable myTable = ExecuteDataTable("merge","SELECT * FROM merge");
string[] fieldNames = new string[myTable.Rows.Count];
object[] fieldValues = new string[myTable.Rows.Count];
for (int i = 0; i < myTable.Rows.Count; i++)
{
DataRow row = myTable.Rows[ i ];
// DataColumn col = myTable.Columns[];
fieldNames = row["Fieldname"];
fieldValues = row["FieldValue"]; //This is what needs to be an object instead of a string
}
--------------------
Here, of course, the compiler throws fits:
-------------------
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
shan.aspx.cs(133,31): error CS0029: Cannot implicitly convert type 'object' to 'string'
---------------------
I vaguely remember creating objects from javascript, but only as a long shdowed dream. I really would appreciate any
help you might give in getting this to work, either by helping me convert the FieldValue to an object or any other
workaround.
Thanks again.
Shannon
First off, I apologize for my ignorance. I am not used to working with non-variants, and it has been a LONG time since
I dealt with OOP.
I need to pass a string to a compiled method that requires an array of objects, like:
execute(string[],object[])
it was obviously created as an object because it was meant to accept input from the page form, but I want to send it
information from a datatable instead. Here's the relevant code:
---------------------
DataTable myTable = ExecuteDataTable("merge","SELECT * FROM merge");
string[] fieldNames = new string[myTable.Rows.Count];
object[] fieldValues = new string[myTable.Rows.Count];
for (int i = 0; i < myTable.Rows.Count; i++)
{
DataRow row = myTable.Rows[ i ];
// DataColumn col = myTable.Columns[];
fieldNames = row["Fieldname"];
fieldValues = row["FieldValue"]; //This is what needs to be an object instead of a string
}
--------------------
Here, of course, the compiler throws fits:
-------------------
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
shan.aspx.cs(133,31): error CS0029: Cannot implicitly convert type 'object' to 'string'
---------------------
I vaguely remember creating objects from javascript, but only as a long shdowed dream. I really would appreciate any
help you might give in getting this to work, either by helping me convert the FieldValue to an object or any other
workaround.
Thanks again.
Shannon