title: If Exists Update Else Insert with VB.net (sql parameterised query)
body: <p>I'm hoping to use the following update\insert method to speed up my application insert\updates:</p>
  
  <pre><code>UPDATE [Application_Type_Table] 
  SET ApplicationType='Test Value'
  WHERE ID='1'
  IF @@ROWCOUNT=0
  INSERT INTO [Application_Type_Table] VALUES ('Test Value')
  </code></pre>
  
  <p>How would I do this with sql parameters? the rowcount function will be picked up as a parameter due to the @@.</p>
  
  <pre><code>sqlCommand.CommandText = _
  "UPDATE [Application_Type_Table]" _ 
  SET (SET ApplicationType=@TestValue" _ 
  "WHERE ID=@RecordID IF @@ROWCOUNT=0 INSERT INTO [Application_Type_Table] VALUES (@TestValue)"
  </code></pre>
  
  <p><a href="http://blogs.msdn.com/b/miah/archive/2008/02/17/sql-if-exists-update-else-insert.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/miah/archive/2008/02/17/sql-if-exists-update-else-insert.aspx</a></p>