protected override void Execute(CodeActivityContext context) { using (SqlConnection connection = new SqlConnection(connectionString.Get <string>(context))) { SqlCommand command = new SqlCommand(SQLStatement.Get <string>(context), connection); SqlDataAdapter da = new SqlDataAdapter(command); try { DataSet ds = new DataSet(); da.Fill(ds); DataRow[] linhas = new DataRow[ds.Tables[0].Rows.Count]; ds.Tables[0].Rows.CopyTo(linhas, 0); data.Set(context, linhas); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { connection.Close(); } } }
protected override void Execute(CodeActivityContext context) { using (SqlConnection connection = new SqlConnection(ConnectionString.Get(context))) { using (SqlCommand command = new SqlCommand(SQLStatement.Get(context), connection)) { connection.Open(); command.ExecuteNonQuery(); } } }