D
Daniel P.
How can I use ADO.NET to insert lots of records in a very fast way?
Thanks!
Thanks!
http://msdn.microsoft.com/library/d...stemdatacommondataadapterclassupdatetopic.aspAlso you can use .Update method of dataAdapter object to load datatable to a db table.
records from a text file. To call the BULK INSERT statement from ADO .NET,SoKool said:Not sure what your exact problem is, however here is a general solution:
You can use the BULK INSERT sql statement to insert large volumes of
Example:
----------
private void Test()
{
SqlConnection conn;
SqlCommand command;
try
{
conn = new SqlConnection("Data Source=MYSERVER;Initial Catalog=Northwind;Integrated_Security=SSPI");
command = new SqlCommand();
conn.Open();
command.Connection = conn;
command.CommandText = "BULK INSERT Northwind.dbo.[Order Details]" +
@"FROM 'f:\orders\lineitem.tbl'" +
"WITH" +
"(" +
"FIELDTERMINATOR = '|'," +
"ROWTERMINATOR = ':\n'," +
"FIRE_TRIGGERS" +
")";
command.ExecuteNonQuery();
}
catch (Exception e)
{
MessageBox.Show (e.Message);
}
}
Daniel P. said:How can I use ADO.NET to insert lots of records in a very fast way?
Thanks!