title: Unexpected parameter marker when trying to run my stored procedure
body: <p>so i be getting a </p>
  
  <blockquote>
    <p>Unexpected parameter marker at position 40 </p>
  </blockquote>
  
  <p>when i try to run my stored procedure 
  which is the </p>
  
  <pre><code>   BEGIN //line 40 
     RETURN 1010
     END
  </code></pre>
  
  <p>i am not exactly sure what that one does and if it has something to do with the way i had decalred the values in the code
  the code</p>
  
  <pre><code>protected String doInBackground(String... params) {
          if (userid.trim().equals("Developer")|| password.trim().equals("Dev!n_234"))
              isSuccess2=true;
          z = getString(R.string.login_succes);
          if(userid.trim().equals("")|| password.trim().equals(""))
              z = getString(R.string.indsæt_rigtigt_bruger);
          else
          {
              try {
                  Connection con = connectionClass.CONN();
                  if (con == null) {
                      z = getString(R.string.Forbindelses_fejl)+"L1)";
  
                  } else {
                      String query = "{call [system].[usp_validateUserLogin](?,?,?,?,?)}";
                      CallableStatement ps = con.prepareCall(query);
                      ps.setString(1, userid);
                      ps.setString(2, password);
                      ps.setInt(3,72);
                      ps.setNull(4, Types.BOOLEAN);
                      ps.registerOutParameter(5, Types.VARCHAR);
                      ps.executeUpdate();
                      Statement stmt = con.createStatement();
                      ResultSet rs = stmt.executeQuery(query);
                      if(rs.next())
                      {
  
                          z = getString(R.string.login_succes);
  
                          isSuccess=true;
                      }
                      else
                      {
                          z = getString(R.string.Invalid_Credentials);
                          isSuccess = false;
                      }
  
                  }
              }
              catch (Exception ex)
              {
                  isSuccess = false;
                  z = getString(R.string.Exceptions)+"L2)";
                  Log.e("MYAPP", "exception", ex);
              }
          }
          return z;
  
      }
  }
  }
  </code></pre>
  
  <p>the stored procedure</p>
  
  <pre><code>    ALTER PROCEDURE [system].[usp_validateUserLogin]
          @p_Login NVARCHAR ( 50 )
          , @p_Password NVARCHAR ( 32 )
          , @p_CompanyID INT
          , @p_OutDetails BIT = 1
          , @p_AuthenticationTicket VARCHAR(200) OUTPUT
      AS
      BEGIN
          SET NOCOUNT ON;
  
          DECLARE @errNo INT
              , @recCount INT
              , @res INT
  
          SELECT u.*
              INTO #tmpLogin
          FROM system.[User] AS u WITH ( NOLOCK )
          WHERE ( u.Login = @p_Login )
              AND ( u.Company_ID = @p_CompanyID )
              AND ( pwdcompare ( @p_Password, u.Passwd ) = 1 )
              AND ( u.Status = 0 ) --Active
  
          SELECT @errNo = @@ERROR
              , @recCount = @@ROWCOUNT
  
          IF ( @errNo &lt;&gt; 0 )
          BEGIN
              RETURN 1010
          END
  
          IF ( @recCount = 1 )
          BEGIN
              DECLARE @userID INT
              SELECT @userID = ID
              FROM #tmpLogin
  
              EXEC @res = system.usp_renewAuthenticationTicket @p_DoerTicket = ''
                                                              , @p_AuthenticationTicket = @p_AuthenticationTicket OUTPUT
                                                              , @p_UserID = @userID
                                                              , @p_CompanyID = @p_CompanyID
              IF ( @res &lt;&gt; 0 )
                  RETURN @res
  
          END
          --SET @p_AuthenticationTicket = 'TESTAUTHENTICATIONTICKET0123456789'
  
          IF ( @p_OutDetails = 1 )
          BEGIN
              SELECT *
              FROM #tmpLogin
          END
  
          RETURN 0
      END
  </code></pre>
  
  <p>my old code</p>
  
  <pre><code>protected String doInBackground(String... params) {
  if(userid.trim().equals("")|| password.trim().equals(""))
  z = "Please enter User Id and Password";
  else
  {
  try {
  Connection con = connectionClass.CONN();
  if (con == null) {
  z = "Error in connection with SQL server";
  } else {
  String query = "select * from Usertbl where UserId='" + userid + "' and password='" + password + "'";
  Statement stmt = con.createStatement();
  ResultSet rs = stmt.executeQuery(query);
  
  if(rs.next())
  {
  
  z = "Login successfull";
  isSuccess=true;
  }
  else
  {
  z = "Invalid Credentials";
  isSuccess = false;
  }
  
  }
  }
  catch (Exception ex)
  {
  isSuccess = false;
  z = "Exceptions";
  }
  }
  return z;
  }
  }
  </code></pre>