Skip to content

Instantly share code, notes, and snippets.

@gbellmann
Created April 13, 2015 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbellmann/6f06ff7fda31bc662846 to your computer and use it in GitHub Desktop.
Save gbellmann/6f06ff7fda31bc662846 to your computer and use it in GitHub Desktop.
Function to insert a record into Azure Table Storage
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
public void InsertOrder(CloudStorageAccount storageAccount)
{
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("orders");
OrderEntity newOrder = new OrderEntity("Smith", "20150410");
newOrder.OrderNumber = "1";
newOrder.OrderDate = Convert.ToDateTime("20150410");
newOrder.ShippedDate = Convert.ToDateTime("20150411");
newOrder.Status = "shipped";
TableOperation insertOperation = TableOperation.Insert(newOrder);
table.Execute(insertOperation);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment