title: How to pass variables into a SQL string field?
body: <p>I tried to pass a variable directly in one of my SQL string field but I didn't find the correct syntax.</p>
  
  <p>I tried by doing " {variable} " or also " @variable " but when I give this to my software, it disps that like a string !</p>
  
  <p>My function which is getting the SQL string (It's working)</p>
  
  <pre class="lang-cs prettyprint-override"><code>public List&lt;Dare&gt; getDares()
          {
              if (myDataSet.Tables["TousLesGages"] != null)
              {
                  myDataSet.Tables["TousLesGages"].Clear();
              }
  
              List&lt;Dare&gt; dares = new List&lt;Dare&gt;();
  
              connect();
  
              query = "SELECT * FROM Dare";
              mySqlCommand.CommandText = query;
              myDataAdapter.SelectCommand = mySqlCommand;
              myDataAdapter.Fill(myDataSet, "TousLesGages");
  
              foreach (DataRow row in myDataSet.Tables["TousLesGages"].Rows)
              {
                  Dare dare = new Dare((int)row.ItemArray[0], 
                                       row.ItemArray[1].ToString(),
                                       category.getCategoryById((int)row.ItemArray[2]),
                                       type.getTypeById((int)row.ItemArray[3]),
                                       null);
                  dares.Add(dare);
              }
  
              return dares;
          }
  </code></pre>
  
  <p>How I disp it :</p>
  
  <pre class="lang-cs prettyprint-override"><code>gage = dare.getDares()[rndGage.Next(0, dare.getDares().Count)];
  lblDare.Text = gage.text;
  </code></pre>
  
  <p>I expect the output of {drink} to be an integer understanding between 1 and 5 (I already created the Random object to permit it, its name is "drink" by the way)</p>
  
  <p><a href="https://i.stack.imgur.com/zEwDr.png" rel="nofollow noreferrer">Server Side</a></p>
  
  <p><a href="https://i.stack.imgur.com/gK7TW.png" rel="nofollow noreferrer">Client Side</a></p>