I have two tables on two different servers. They're both exactly the same, other than the table on one server has no data.
I want to write a LinqToSql program that will copy the data from one table to the other. There's only about 7k records. This is a run-once program.
The error I'm getting is "Ambiguous constructor reference". It's because when I'm trying to create a new Circuit object to write to the sandbox Circuits table, it doesn't know which one I'm talking about: The Circuit in the Dev context or the Circuit in the Sandbox context.
I guess what I need to do know is if I can use an alias, or something, in order to differentiate between the two Circuits data objects in each context?
Basically, I just need to get all the data in one table to an exact duplicate table on another server.
class Program
{
static void Main(string[] args)
{
// set up data contexts
var circuitsDev = new CircuitsDevDataContext();
var circuitsSandbox = new CircuitsSandboxDataContext();
// loop through each record in CircuitsDev data and write it to second table.
foreach (var circuitData in circuitsDev.Circuits)
{
// create new sandbox circuit object
// This is where error is.
var circuit = new Circuit(); // <== ambiguous error
circuit = circuitData;
circuitsSandbox.Circuits.InsertOnSubmit(circuit);
}
circuitsSandbox.SubmitChanges();
}
}