Re: Bulk inserts into SQL Server 2000 from Flat Files
- From: "David Browne" <davidbaxterbrowne no potted meat@xxxxxxxxxxx>
- Date: Tue, 21 Feb 2006 18:18:20 -0600
"Jason Allred" <Jasonthemasonkcch@xxxxxxxxxxxxxxxxx> wrote in message
news:eiSuoVzNGHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
This is my first post, so if this has been addressed before, please excuse
my ignorance...
I'm writing a Window's Service in VB.NET to take information from flat
files that contain GPS information and subsequently save them to a SQL
Server (2000) database. I have created classes / collections that do all
the work of retrieving the information from the flat files. That seems to
have been the easy part. Now in trying to get them into the DB, (just one
table), I find that creating several thousand insert statements is very
unwieldy,
Yes it is.
and results in records getting dropped.
No it doesn't, you had a bug.
I've looked at creating a dataset, but haven't found any examples online
that I could twist to my purposes yet.
The main problem I seem to be having is first getting the information from
the objects into a dataset, and then subsequently into the database. Does
anyone have any advice.
Either upgrade to ADO.NET 2.0 / SQL Server 2005 and use SQLBulkCopy
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx
Or just use SqlCommand and insert statements. Remember to wrap the
individual inserts in a SqlTransaction for the best performance.
David
.
- References:
- Bulk inserts into SQL Server 2000 from Flat Files
- From: Jason Allred
- Bulk inserts into SQL Server 2000 from Flat Files
- Prev by Date: Re: Saving DataTable as XML
- Next by Date: Re: Bulk inserts into SQL Server 2000 from Flat Files
- Previous by thread: Bulk inserts into SQL Server 2000 from Flat Files
- Next by thread: Re: Bulk inserts into SQL Server 2000 from Flat Files
- Index(es):
Relevant Pages
|