ArrayList arrayc = new ArrayList(); arrayc.Insert(0, "hi"); arrayc.Insert(1, "asd"); arrayc.Insert(2, "weras"); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); ds.Tables[0].Columns.Add("name", System.Type.GetType("System.String")); foreach (string str in arrayc) { DataRow row = ds.Tables[0].NewRow(); row[0] = str; ds.Tables[0].Rows.Add(row); } SqlConnection con = new SqlConnection("Data Source=sourceconn;database=dbname;Trusted_Connection=true"); con.Open(); SqlBulkCopy bc = new SqlBulkCopy(con); bc.BatchSize = 30; bc.NotifyAfter = 30; bc.SqlRowsCopied += new SqlRowsCopiedEventHandler(bc_SqlRowsCopied); bc.DestinationTableName = "ase"; bc.WriteToServer(ds);
try { SqlDataAdapter1.Update(Dataset1.Tables["Table1"]); } catch (Exception e) { // Error during Update, add code to locate error, reconcile // and try to update again. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)