Insert command into an invoke command in c#
You can't assign a string to a variable of type ScriptBlock
. You need to create the script block using the static create method (Note: the ScriptBlock constructor is protected so you can't use it) e.g.:
var s = ScriptBlock.Create(command.CommandText);
As for adding the parameters, try this:
foreach (var p in basis.Parameters) { invokeScript.Parameters.Add(p.Name, p.Value);}
The Join Linq command combines two sequences but the combined sequence is output as a result of the Join command. It doesn't modify either of the original two sequences.