I have a C# console app "App1" that reads a row of data from a table in a SQL Server 2005 DB. I want App1 to pass all the data in this row to App2, another C# console app. What is the best way to do this?
My first (naive) attempt was to do this:
object[] o = myrow.ItemArray;
// make a string that separates each item by a space... for example "1 2 myVar".
// pass this string to App2 via command line.
This has some flaws: what if one of the entries in the row was "my var" instead of "myVar"? Also, the order of the items would be hardcoded in the receiving app (App2).
So what's the best way to do this? Would it be appropriate to pass an xml string to App2 via command line?
Cheers!