Object Reference is null when creating the object
<p>I've tried searching around, but most of the answers were about instantiating a list that doesn't exist or otherwise isn't exactly what I'm looking for. Most of the questions I've come across weren't using the "new" keyword.</p>

<p>Here's what I've got:</p>

<pre><code>using (SqlCmd cmd = new SqlCmd("SELECT * FROM [User] WHERE Login = @Login", false))
{
  cmd.AddIString....
}
</code></pre>

<p>My problem is on that first line. Visual Studio is fine with it until I try to run it. Then it throws an error <code>Object reference not set to an instance of an object</code>. It threw the error even when it looked like:</p>

<pre><code>using (SqlCmd cmd = new SqlCmd(
  "SELECT * " +
  "FROM [User] " + 
  "WHERE Login = @Login", false))
{
  // Code here...
}
</code></pre>

<p>Any ideas? I've rewritten it, looked at other methods that do the exact same thing, used Google, etc for about 2 hours now with no real result. Closing Visual Studio didn't do anything either, except cause the same problem on code that was working previously.</p>

<p>EDIT: I did say first line, but here it is a bit more clearly (Line 74):</p>

<pre><code>Line 72:     {
Line 73:         //using (SqlCmd cmd = new SqlCmd("SELECT * FROM [User]  WHERE Login = @Login", false))
Line 74:         using (SqlCmd cmd = new SqlCmd("SELECT * FROM [User] WHERE Login = @Login", true))
Line 75:         {
Line 76:             cmd.AddIString("@Login", 100, login);
</code></pre>
