protected override void ProcessRecord() { try { CMSQLClient.ExecuteNonQuery(ConnectionString, Statement); } catch (Exception ex) { WriteObject(ex.Message.ToString()); } }
protected override void ProcessRecord() { try { DataTable queryResult = CMSQLClient.ExecuteQuery(ConnectionString, Statement); foreach (DataRow row in queryResult.Rows) { PSObject obj = new PSObject(); for (int i = 0; i < queryResult.Columns.Count; i++) { obj.Members.Add(new PSNoteProperty(queryResult.Columns[i].ColumnName, row[i].ToString())); } WriteObject(obj); } } catch (Exception ex) { WriteObject(ex.Message.ToString()); } }