title: Safest way to run query from client into sql server using Asp net
body: <p>I am new in asp net, i need to ask which is the safest way to run a query from my client into asp net and then into sql server.</p>
  
  <p>First option i am using till now, i create my query from client, example</p>
  
  <pre><code>"insert into customers (name) values('john')"
  </code></pre>
  
  <p>And inside asp net i just take my string from client and just excecuted.</p>
  
  <pre><code>Inside Post method:
  //Here i am getting query from client:
  SqlConnection connection = new SqlConnection(connectionString);
  SqlCommand cmd = new SqlCommand(queryFromClient,connection);
  cmd.ExecuteNonQuery();
  </code></pre>
  
  <p>I am looking for making my queries more safe, if i will have any injection or hacking into my server, someone can easy send  whatever query he wants, delete database or anything else...
  So i am looking a way for prevent this.</p>