sql server - save DataTable to database -


hi, generating datatable webservice , save whole datatable 1 database table.

datatable ds = //get info webservice 

the datatable getting generated next .i getting stuck .show me syntax.i dont need select statement there either, want insert info datatable blank db table.

use bulkcopy, code. , make sure 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);} 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -