Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In this line:</p> <pre><code>var query = "Select Username From Login Where Username ='" + comboBox1 + "' and Password ='" + textBox2.Text + "'"; </code></pre> <p>You're trying to concatenate a <code>String</code> and a <code>Control</code> together. (<code>ComboBox</code> is a subclass of <code>Control</code>) This is not allowed. What you need to use is the <code>SelectedText</code> property of <code>ComboBox</code>:</p> <pre><code>var query = "Select Username From Login Where Username ='" + comboBox1.SelectedText + "' and Password ='" + textBox2.Text + "'"; </code></pre> <p>Incidentally, I would strongly advise using <strong>prepared statements</strong> to ensure users don't enter their own SQL code into the username and password fields, and potentially compromise the security of your database. This usually involves setting the query string with parameter names (val0, val1 etc.) instead of the raw text <code>comboBox1.SelectedText</code>, <code>textBox2.Text</code>.</p> <p>Information on prepared statements in Microsoft SQL: <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.prepare(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.prepare(v=vs.110).aspx</a></p> <p>Information on prepared statements in MySQL: <a href="http://dev.mysql.com/doc/refman/5.0/en/connector-net-programming-prepared.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/connector-net-programming-prepared.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload