-
Nov 17th, 2014, 11:12 PM
#1
Thread Starter
Frenzied Member
Quick question about SQLBulkCopy
Hello,
I have a VB.NET program that uses SQL Express on a pc tablet. I need to get the data from the device and insert them on a PC in the office with SQL Express. So I read about SQLBulkCopy and it sounds like that will work. It said the data source can be different types so what type should I put the data in from the tablet. I need to export the data to a file. Should it be a csv or what format? I have all different field types such as varchar, int, bit, etc, being used in the tables I need to export.
Thanks,
Warren
-
Nov 18th, 2014, 03:33 AM
#2
Re: Quick question about SQLBulkCopy
If you're talking about using the SqlBulkCopy class in a VB.NET app then you need to import your data into a DataTable. How you do that is completely irrelevant to the actual bulk copy operation. You just have to make sure that that DataTable has a schema that matches your database and that the data is valid, e.g. all values are provided for non-nullable columns.
-
Nov 18th, 2014, 01:05 PM
#3
Re: Quick question about SQLBulkCopy
IT doesn't even need to be a file. As jmc noted, you just need the data in a DataTable. So if you have the data in a local database, you can simply select from your local database filling a datatable, then use the SQLBulkCopy to stuff it into SQL Server.
-tg
-
Nov 18th, 2014, 04:16 PM
#4
Re: Quick question about SQLBulkCopy
Do you need to do this in .Net code? SQLCMD is a command prompt utility for doing all kinds of SQL interaction.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|