Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
GeneralRe: desrialization fail due to xsi:type Pin
jainiraj20-Jul-10 2:06
jainiraj20-Jul-10 2:06 
AnswerAlmost always a namespace issue Pin
Ennis Ray Lynch, Jr.20-Jul-10 3:23
Ennis Ray Lynch, Jr.20-Jul-10 3:23 
GeneralRe: Almost always a namespace issue Pin
jainiraj20-Jul-10 20:37
jainiraj20-Jul-10 20:37 
GeneralRe: Almost always a namespace issue Pin
Ennis Ray Lynch, Jr.21-Jul-10 3:22
Ennis Ray Lynch, Jr.21-Jul-10 3:22 
GeneralRe: Almost always a namespace issue Pin
jainiraj21-Jul-10 19:45
jainiraj21-Jul-10 19:45 
QuestionCompare 2 DataTables and insert differences into first table Pin
norjali19-Jul-10 22:21
norjali19-Jul-10 22:21 
AnswerRe: Compare 2 DataTables and insert differences into first table Pin
Peace ON19-Jul-10 22:35
Peace ON19-Jul-10 22:35 
AnswerRe: Compare 2 DataTables and insert differences into first table Pin
PIEBALDconsult20-Jul-10 3:31
mvePIEBALDconsult20-Jul-10 3:31 
The first thing to try is an INSERT...SELECT...WHERE statement, but that won't work in all cases.

If I have to resort to programming, then depending on the situation (number of rows and columns etc.), I might just throw all the rows in table 2 at table 1 and see what sticks.

0) Ensure that table 1 has a unique index that covers everything that needs to be covered.
1) Set up a parameterized INSERT command for table 1 (this requires a second Connection)
2) Open a DataReader against table 2.
3) Iterate the DataReader
3.1) Set the parameters
3.2) In a try/catch, Execute the INSERT, and ignore (or log) duplicate exceptions


This allows the database to check whether or not the row exists so you don't wind up checking it twice. The big sticking point is the index -- how much data will need to be in the index?

You may also want a Transaction.



Edit: Oh, wait, you meant DataTables? Why would you need to do that?
QuestionHow to open a word document from C# application Pin
seeism19-Jul-10 22:04
seeism19-Jul-10 22:04 
AnswerRe: How to open a word document from C# application Pin
Luc Pattyn19-Jul-10 22:57
sitebuilderLuc Pattyn19-Jul-10 22:57 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 0:26
seeism20-Jul-10 0:26 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 0:44
seeism20-Jul-10 0:44 
AnswerRe: How to open a word document from C# application Pin
Peace ON19-Jul-10 23:04
Peace ON19-Jul-10 23:04 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 0:27
seeism20-Jul-10 0:27 
AnswerRe: How to open a word document from C# application Pin
Luc Pattyn20-Jul-10 0:43
sitebuilderLuc Pattyn20-Jul-10 0:43 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 0:49
seeism20-Jul-10 0:49 
GeneralRe: How to open a word document from C# application Pin
Luc Pattyn20-Jul-10 1:12
sitebuilderLuc Pattyn20-Jul-10 1:12 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 1:25
seeism20-Jul-10 1:25 
GeneralRe: How to open a word document from C# application Pin
seeism20-Jul-10 19:00
seeism20-Jul-10 19:00 
QuestionError Getting Processor Id Pin
PDTUM19-Jul-10 13:44
PDTUM19-Jul-10 13:44 
AnswerRe: Error Getting Processor Id Pin
Luc Pattyn19-Jul-10 14:20
sitebuilderLuc Pattyn19-Jul-10 14:20 
GeneralRe: Error Getting Processor Id Pin
PDTUM19-Jul-10 16:50
PDTUM19-Jul-10 16:50 
Questionnode hottracking Pin
xilefxilef19-Jul-10 12:39
xilefxilef19-Jul-10 12:39 
Questionpass resource name as variable Pin
Jassim Rahma19-Jul-10 12:21
Jassim Rahma19-Jul-10 12:21 
AnswerRe: pass resource name as variable Pin
Luc Pattyn19-Jul-10 12:40
sitebuilderLuc Pattyn19-Jul-10 12:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.