Cancelado

Batch Updates for Large Data in C#

Okay, I need some help. I can't seem to find the absolute correct and standard way to accomplish this. So, I need to turn to the experts :).

I have a datatable, lets call it documents. It has 3 fields:

docid (pkey, identity, increments)

url (string, should be unique)

body (string)

I am using sql server 2005 and .net 2.0 (c#). I need to know 2 things.

1) How can I tell sql server, that the url field should be unique, and that someone attempts to put 2 of the same url into the db, an error should be thrown?

2) How can I do large batch updates to avoid trips to the db? Right now, I have an external source (spider) providing urls, and bodies for the table. I also have a very fast cache of hashes of the urls and ids. So I can very quickly check if a url needs to be updated or inserted by checking this cache.

The spider gives me a collection of objects, which are essentially url, body pairs. I then check to see which urls do not exist, using the cache, and insert these urls using sqlbulkcopy. sqlbulkcopy is mega fast!

Next I gather the urls that do exist, (using the cache), currently I use the attached algorithm to populate a DataTable and try to update the datasource with this table. But I get an error saying that rows marked with new must use an insert command, so I believe I'm doing something wrong. The message is: {"Update requires a valid InsertCommand when passed DataRow collection with new rows."}

So the question is: How can I do a faster/easier batch update when the is external to sql server?

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

.net 2.0

sql server 2005

Habilidades: Programação C#, Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software, SQL

Ver mais: string algorithm, sql package body, sql experts hire, sql coder hire, hire php experts, get external data, find coder hire, find algorithm experts, engineering hire, data algorithm, get string, algorithm string, absolute software, absolute hire, find experts field, experts hire, large data, data source sql, data in, data experts, data collection software, data checking, cache c, batch, batch program

Acerca do Empregador:
( 44 comentários ) United States

ID do Projeto: #2975951

6 freelancers estão ofertando em média $113 para este trabalho

SebastianSDS

See private message.

$148.75 USD in 2 dias
(129 Comentários)
7.8
CroDev

See private message.

$85 USD in 2 dias
(14 Comentários)
5.7
neatcodersl

See private message.

$148.75 USD in 2 dias
(32 Comentários)
4.9
jrhvw

See private message.

$85 USD in 2 dias
(21 Comentários)
4.8
unisysvw

See private message.

$85 USD in 2 dias
(4 Comentários)
2.8
cliquerz

See private message.

$127.5 USD in 2 dias
(0 Comentários)
0.0