Hi, I am generating a DataTable from a webservice and i would like to save the whole DataTable into one database table.
DataTable ds = //get info from webservice
The DataTable is getting generated but What to do next .I am getting stuck .Show me some syntax.I dont really need the select statement there either, i just want to insert all the info from the DataTable into a blank db table.
Use bulkcopy, this is the code. And make sure that the table has no foriegn key or primary key constraints.
SqlBulkCopy bulkcopy = new SqlBulkCopy(myConnection);
bulkcopy.DestinationTableName = table.TableName;
try
{
bulkcopy.WriteToServer(table);
}
catch(Exception e){messagebox.show(e.message);}