title: Must declare scalar variaable @ID when inserting record
body: <p>I am inserting a record in DB, I am using inline query, I have to get the generated ID, this is how I am doing this</p>
  
  <pre><code> var query = "INSERT INTO [Users] ([Username],[Password])  VALUES(@username,@pwd) SELECT @ID = SCOPE_IDENTITY()";
              OleDbParameter[] queryparam = new OleDbParameter[3];
              queryparam[0] = new OleDbParameter("@username", OleDbType.VarChar);
              queryparam[0].Value = "username";
              queryparam[1] = new OleDbParameter("@pwd", OleDbType.VarChar);
              queryparam[1].Value = "123456";
              queryparam[2] = new OleDbParameter("@ID", OleDbType.Integer);
              queryparam[2].Direction = ParameterDirection.Output;
  
               OleDbCommand myCommand = new OleDbCommand();
                myCommand.Connection = DBConnectionHelper.getConnection();
                  myCommand.CommandText = query;
                  myCommand.Parameters.AddRange(queryparam);
                  adapter.InsertCommand = myCommand;               
                  myCommand.ExecuteNonQuery();
  </code></pre>
  
  <p>I am getting error:</p>
  
  <blockquote>
    <p>Must declare the scalar variable "@ID".</p>
    
    <p>Must declare the scalar variable "@username".</p>
  </blockquote>
  
  <p>I also tried using <code>(int)myCommand.ExecuteScalar()</code> but no luck.</p>
  
  <p>How can I get generated ID in this case?</p>