Build Big-Data Apps: Listing 1.

Connecting to the Federation Root Database

/ Create a Connection to the Federation Root
SqlGuid fedKeyValue = customerId;
SqlConnection connection = 
  new SqlConnection(@"Server=tcp:sqlAzureURI;
  Database=SalesDB;User ID=mylogin@myserver;
  Password=mypassword")
connection.Open();

// Route to the Specific Customer's Atomic Units
SqlCommand command = connection.CreateCommand())
command.CommandText = 
  "USE FEDERATION Orders_Federation(" +
  fedKeyValue.ToString() + ") WITH RESET";
command.ExecuteNonQuery();

About the Author

Roger Jennings is an independent XML Web services and database developer and writer. His latest books include "Special Edition Using Microsoft Office Access 2007" (QUE Books, 2007) and "Expert One-on-One Visual Basic 2005 Database Programming" (WROX/Wiley, 2005). He’s also a VSM contributing editor and online columnist and manages the OakLeaf Systems blog. Jennings’ Code of Federal Regulations Web services won Microsoft’s 2002 .NET Best Horizontal Solution Award. Reach him at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube