public bool Excute(string TableName, DataTable Table, SqlDataAdapter SqlDa) { AutoCreatAdapterCommand AC = new AutoCreatAdapterCommand(TableName, "SQL Server"); SqlDa.TableMappings.Add(AC.TableMapping); SqlDa.AcceptChangesDuringUpdate = true; AC.InsertString.Connection = this.DC.myConn; AC.DeleteString.Connection = this.DC.myConn; AC.UpdateString.Connection = this.DC.myConn; SqlDa.InsertCommand = (SqlCommand)AC.InsertString; SqlDa.UpdateCommand = (SqlCommand)AC.UpdateString; SqlDa.DeleteCommand = (SqlCommand)AC.DeleteString; try { SqlDa.Update(Table); return(true); } catch { return(false); } }
public bool Excute(string TableName, DataTable Table, SqlDataAdapter SqlDa) { AutoCreatAdapterCommand AC = new AutoCreatAdapterCommand(TableName, "SQL Server"); SqlDa.TableMappings.Add(AC.TableMapping); SqlDa.AcceptChangesDuringUpdate = true; AC.InsertString.Connection = this.DC.myConn; AC.DeleteString.Connection = this.DC.myConn; AC.UpdateString.Connection = this.DC.myConn; SqlDa.InsertCommand = (SqlCommand)AC.InsertString; SqlDa.UpdateCommand = (SqlCommand)AC.UpdateString; SqlDa.DeleteCommand = (SqlCommand)AC.DeleteString; try { SqlDa.Update(Table); return true; } catch { return false; } }