开发者

Upgrading to SQL Server 2008: Upgrading a VS2005 .NET program that uses BCP

开发者 https://www.devze.com 2023-04-08 14:04 出处:网络
I have VS2005 .NET C# program. My understanding is that VS2005 targeted only the 2.0 versi开发者_运维知识库on of the .NET FW. The program uses the Bulk copy object. I believe the source dll of this ob

I have VS2005 .NET C# program. My understanding is that VS2005 targeted only the 2.0 versi开发者_运维知识库on of the .NET FW. The program uses the Bulk copy object. I believe the source dll of this object is the System.Data.dll file in the Version 2 Framework system folder.

My guess is that the System.Data.dll must be calling the SQL Server 2005 version iof the BCP.exe when using the BulkCopy object. At the current time, our database server has both the 2005 and 2008 versions of the BCP.exe on it. Soon, the 2005 version will be removed and I need to ensure that my .NET program will continue to run.

My thought is to use VS2008 to upgrade the app to the 3.5 version of the Framework, which I verified is on the DB server. In fact, I see that all version of the FW are there, including 1,1,2.0,3.5 and 4.0. I'm thinking that if I upgrade to the 3.5 FW that the 2008 version of the BCP.exe will be used.

How do I know which version of the the bulkcopy (BCP.exe) I am using in order to ensure that the program continues to work when only the 2008 BCP.exe remains on our db server?

Upgrading to SQL Server 2008: Upgrading a VS2005 .NET program that uses BCP


If you are talking about SqlBulkCopy class, then it does not use bcp.exe at all. So your app will run as expected after upgrade.

P.S. There is no connection between Framework version and SQL Server version.


From the MSDN docs for SqlBulkCopy:

Microsoft SQL Server includes a popular command-prompt utility named bcp for moving data from one table to another, whether on a single server or between servers. The SqlBulkCopy class lets you write managed code solutions that provide similar functionality.

In other words, bcp.exe is unrelated to your issue.

The System.Data.SqlClient namespace included in newer versions of the .NET Framework generally works against older SQL Server versions; I have yet to see any place in the MSDN docs where they failed to call out SQL Server backward-compatibility issues. Your safest bet is to just rebuild for .NET 3.5 or 4.0, as you said, so that it picks up the latest System.Data.SqlClient code (which handles compatibility for you).

If you're curious about what it's doing, you can run Sql Server Profiler while running your application, and see what SQL is actually being generated by SqlBulkCopy. You should see relatively simple SQL that is verifiably 2008-compatible.


  • If your app runs on a different server/PC that doesn't have any SQL Server compoents installed it will still work (assuming you have .net framework)
  • SqlBulkCopy class does not call bcp.exe. It is absolutely unrelated
  • It doesn't matter what version of bcp.exe may or may not be installed
  • Your application's use of SQLBulkCopy is not affected by SQL Server version
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号