.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Bulk Copy From Datatable To SQL Server Table

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

 I have read the data of a excle file and captured the data into the dataset to a datatable, now that data is to be inserted into a SQL Server table using bulk copy option. I am using -

 public bool BulkEnterData(DataTable dt, string tblName)
        SqlBulkCopy bulk = new SqlBulkCopy(con);
        bulk.DestinationTableName = tblName;

        return true;

ERROR Getting-
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.) 

How to resolve the above problem or any other solution is available.


View Complete Post

More Related Resource Links

Bulk copy from SQL Server to a managed app on network.


I am dealing with a perf issue.

We have code (SQL CLR triggers) that can take a few changes from a table and send them over a network to a recipient server, this recipient caches the data in memory, and appears as a .Net collection to local apps running on the recipinet server (there is no SQL server running on the recipient).

As changes are made to the table in SQL server, the managed trigger gets these, packs them into a class we designed (that stores rows/columns and some other details) and then uses binary serialization to send them over the network, the recipinet server (a managed code NT service) deserializes and updates its local cached copy.

The network IO is done by our own simple classes that use TcpClient and so on.

As a trigger this works OK, so I leveraged the trigger code so that I can also use it to pre-populate the remote server, by "pretending" every row has been changed and just sending the data, so we use the C# trigger library as a bulk upload from SQL Server to our remote recipient.

But this is proving far too slow, I am still pinning down why and where, but suspect the network cost is high, 10 rows from a table with 10 columns ends up being sent as a serialzied blob 10,500 byte long, or about three times the size of the raw data bytes in the rows.

So our bulk upload is taking hours for ve

Bulk Insert into SQL Server Table With XML


Hey There,


Here, is the example of Bulk Insert into SQL Server Table.

From Application you have to pass a XML string to a Stored Procedure and it will insert all data into table using that XML.

Example SP.




      @strXML varchar(8000)



      Declare @intPointer int

      exec sp_xml_preparedocument @intPointer output, @strXML<

copy data (table) SQL server to Oracle


I want to copy or transfer data SQL server to Oracle 10 G. any body can help me.


Temporary tables in SQL Server vs. table variables

When writing T-SQL code, you often need a table in which to store data temporarily when it comes time to execute that code. You have four table options: normal tables, local temporary tables, global temporary tables and table variables. I'll discuss the differences between using temporary tables in SQL Server versus table variables.

Under the Table: Programming with FileStreams in SQL Server 2008


There's always been disagreement about whether large blobs, such as document and multimedia items, should be stored in the database or file system. In SQL Server 2008 you don't have to choose; filestream storage provides the best of both approaches.

Bob Beauchemin

MSDN Magazine May 2009

Under The Table: Spatial Data Support In SQL Server 2008


New spatial data support in SQL Server 2008 opens the door to mapping and querying geometric and geographic data, allowing you to build exciting new applications.

Bob Beauchemin

MSDN Magazine February 2009

Bulk Copy Operations in ADO.NET 2.0


Bulk copying of data from one data source to another data source is a new feature added to ADO.NET 2.0. Bulk copy classes provides the fastest way to transfer set of data from once source to the other.

Each ADO.NET data provider provides bulk copy classes. For example, in SQL .NET data provider, the bulk copy operation is handled by SqlBulkCopy class, which is described in Figure 1. As you can see from Figure 1, data from a data source can be copied to one of the four types - DataReader, DataSet, DataTable, or XML.

generate create script of table using c# and SQL server 7.0, can anyone help me?


I want to generate create table script using c#.net, I want to connect sql server 7.0 and generate table create script. Its urgent kindly help me urgently.

sql server 2005 express - don't allow to create table

i have downloaded sql server 2005 Express version from the web and use domainname\SQLEXPRESS as server name but now i can't create table seems every create by sa user, what is the password of this user or how to grand right to my window login user so that i can modify/create something in database.

Creating a table-valued function on a user defined type in SQL Server CLR

We would like to be able to create a table-valued function on a user defined type.  We would like the syntax in SQL to look like it works for the XML nodes function:   DECLARE @myXml XML = '<a><b>1</b><b>2</b><b>3</b></a>' ; SELECT  node.query('text()') FROM    @myXml.nodes('a/b') nodes (node) ;   In other words, in the FROM clause, we can access the "nodes" method of the xml variable and it returns a rowset. Thanks!

Triggering an event to occur within a VB.NET app if something is inserted into an SQL Server table

Let's say SQL Server is inserting arow within a table. Is there a way to let VB.NET know that an event was fired (being the inserting of the row within the table), without the need to query anything. Bascially having SQL Server tell the VB.NET app that an event was fired. It seems like it might be possible using CLR and the .NET framework integration wthin SQL Server, but I haven't found a sample program showing what I'm attempting. I understand that this topic covers SQL Server and VB.NET.  This need being for both and this forum only set for SQL Server, I thought I'd take the risk and post in this forum. Thank you in advance for any assistance.Newbie

How to create a view in my database from a table in another server/database

Is there a way to create a view in my database referencing a table in another server/database if I have the connection information.  I know how to do it in Oracle, simply create a database link, but have never done so in sqlserver.

unable to create new table in sql server 2000 enterprise manager on windows7(Operating system)

i have successfuly installed sql server 2000 on windows7 and i am able to browse all the tables and edit aswell(on enterprise manager) but i have a problem while creating new tables it says ' MMC has detected an error in a snap-in' and provides options to either continue with the error or send a report to microsoft ,   Please help regarding this compatibility issue   Thanks in advance !

SQL Server to SQL Server Compact Edition Database Copy

I recently switched from XP to Win 7 and am getting an error when using the SQL Server to SQL Server Compact Edition Database Copy wizard from johnnycantcode.com (link). I suspect that the problem is with the configuration of the path for the DQL CE dll. 1) Does anyone know where the configuration is set? It isn't in the GLT.SqlCopy.exe.config file in the local directory. 2) Has anyone got the program to run under Win 7? Thanks marc  

How to copy table data from test to production database

I'm using SQL Server 2008 R2 and I'd like to copy all data rows from one table of a test database to the identical table in a production database. The primary key of the table is referred to by other tables so a DELETE followed by a number of INSERTs won't do it because of referential integrity issues. What is the best method to replace the data rows in the destination database with the values from the source database? Thanks, Guido

How to get a Table name from the column Value in Sql Server?

Hi All,I have a number of tables in the database and i have a column value as "abc" coming from one of the tables in the database,Now i need to find the table name from where this column value is coming?

What is loweredrolename meant in aspnet_users table (SQL Server 2005)

For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too. Anyone knows what is the use of column LoweredRoleName in aspnet_users table?For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too. Anyone knows what is the use of column LoweredRoleName in aspnet_users table?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend