I have 2 MS Access 2003 databses, one is third party so I cannot modify it, and the other is a db I designed to grab the info I need and add a few other columns. I am writing a C# program to perform an Insert of all the records that exist in the 3rd party db, but not in my DB, but I cannot figure out how to do this.
I originally wrote the code in Access VBA via a form timer, a linked table to the third party db (CZPrintJobs) into my db, and the below SQL statement. this worked, but I was told that C# 2003 would be the better way to handle this. I'd rather not link the table as it's twice the space and mean location is less flexible.
I realize the oleDBcommand only contains 1 db connection, so I think I have to run this as a select command, and then an insert, but even the select command would require accessing both dbs. Help would be most appreciated!
I originally wrote the code in Access VBA via a form timer, a linked table to the third party db (CZPrintJobs) into my db, and the below SQL statement. this worked, but I was told that C# 2003 would be the better way to handle this. I'd rather not link the table as it's twice the space and mean location is less flexible.
I realize the oleDBcommand only contains 1 db connection, so I think I have to run this as a select command, and then an insert, but even the select command would require accessing both dbs. Help would be most appreciated!
Code:
"INSERT INTO PAPrintJobs ( Id, Copies, Printer, Computer, Owner, Document, SubmittedDate, SubmittedTime, JobStatus, TotalPages, Cost )" + "SELECT CZPrintJobs.Id, " + "CZPrintJobs.Copies, " + "CZPrintJobs.Printer, " + "CZPrintJobs.Computer, " + "CZPrintJobs.Owner, " + "CZPrintJobs.Document, " + "CZPrintJobs.SumittedDate, " + "CZPrintJobs.SumittedTime, " + "CZPrintJobs.JobStatus, " + "CZPrintJobs.TotalPages, " + "CZPrintJobs.Cost " + "FROM CZPrintJobs " + "LEFT JOIN PAPrintJobs " + "ON (CZPrintJobs.Owner = PAPrintJobs.Owner) AND " + "(CZPrintJobs.Id = PAPrintJobs.Id) AND " + "(CZPrintJobs.SumittedDate = PAPrintJobs.SubmittedDate) AND " + "(CZPrintJobs.SumittedTime = PAPrintJobs.SubmittedTime) " + "WHERE (((CZPrintJobs.Id) Like 'O*') AND ((PAPrintJobs.Id) Is Null) AND ((CZPrintJobs.JobStatus) = 'Printed'));";
Comment