public static void Shop_CalculateRefund(string StoreName, string APIKey, string Password, long OrderID, string JsonString) { ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password); SqlPipe p = SqlContext.Pipe; // Create a new record with the column metadata. The constructor is // able to accept a variable number of parameters. SqlDataRecord record = new SqlDataRecord( new SqlMetaData[] { new SqlMetaData("ShippingAmount", SqlDbType.NVarChar,18), new SqlMetaData("ShippingTax", SqlDbType.NVarChar,18), new SqlMetaData("MaximumRefundable", SqlDbType.NVarChar,18), new SqlMetaData("RefundLineItems", SqlDbType.Int,4), new SqlMetaData("Transactions", SqlDbType.Int,4)} ); Refund r = sp.CalculateRefund(OrderID, JsonString); // Mark the begining of the result-set. SqlContext.Pipe.SendResultsStart(record); // Set the record fields. record.SetString(0,r.shipping.amount); record.SetString(1, r.shipping.tax); record.SetString(2, r.shipping.maximum_refundable); record.SetInt32(3, r.refund_line_items.Count); record.SetInt32(4, r.transactions.Count); //record.SetInt32(1, 42); //record.SetDateTime(2, DateTime.Now); // Send the row back to the client. SqlContext.Pipe.SendResultsRow(record); // Mark the end of the result-set. SqlContext.Pipe.SendResultsEnd(); // Send the record to the calling program. SqlContext.Pipe.Send(record); }