public bool BulkEnterData(DataTable dt, string tblName)
{
SqlBulkCopy bulk = new SqlBulkCopy(con);
bulk.DestinationTableName = tblName;
con.Open();
bulk.WriteToServer(dt);
con.Close();
return true;
}
to run sqlbulkcopy u must define listed below if it give u an error {A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.)}
Go to Start -> Programs -> Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Surface Area Configuration.
Then go to "Surface Area Configuration for Services and Connections"
Then select "Remote Connections" under "Database Engine" option.
Then select "Using both TCP/IP and named pipes" radio button under Local and remote connections.
Author:
Aamir Hasan औथोर:
आमिर हसन أثر
أمير حسن .
60c96090-04d3-42b6-94c7-c6d9afb1cb75|0|.0
ALL, CSharp, SQL 2005 & 2008
asp.net, csharp, sql,