title: Checking database acting as mirror
body: <p>In my VB.NET app I'm doing some simple SELECTs against a SQL Server view. The view is on two linked server connections on our local SQL Server.</p>
  
  <p>The two linked servers are changing from time to time its Master/Mirror behavior. So in my app I don't know which of the servers is actually the master.</p>
  
  <p>At the moment I fire my query and catch the sqlexception which is something like: "the database is acting as mirror" if I get this exception I change the connection and do the query twice.</p>
  
  <p>Is there a way to check the status of the server before firing queries?</p>