title: How to call stored procedures from android app?
body: <p>I want to call a stored procedure from sql server to operate a login page 
  but keep getting this error:</p>
  
  <pre><code>import java.sql.CallableStatement;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
  
  public class Sp
  {
      public static void main(String[] args)
      {
  
           String dbName = "My_database";
           String serverip="192.168.5.10";
           String serverport="1433";
  
           String url = "jdbc:sqlserver://"+serverip+"\\SQLEXPRESS:"+serverport+";databaseName="+dbName+"";
  
  
           try
  
          {
              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
          }
  
          catch(ClassNotFoundException ex)
          {
              ex.printStackTrace();
          }
  
          Connection con=null;
          CallableStatement cstmt=null;
          try
          {
  
               String databaseUserName = "sa";
               String databasePassword = "a123";
  
              con= DriverManager.getConnection(url, databaseUserName, databasePassword);
  
  
              cstmt=con.prepareCall("{? = call spLoginvalidate(@CO_ID)}");//called the procedure
                                          //how to create procedure had writen in  bellow
              cstmt.executeUpdate();
              System.out.println("done");
          } 
  
          catch(SQLException ex)
          {
              ex.printStackTrace();
          }
          finally
          {
              try
              {
                  if(cstmt!=null) //close the callablestatement
                  {
                      cstmt.close();
                      cstmt=null;
                  }
              }
              catch(SQLException ex)
              {
                  ex.printStackTrace();
              }
              try
              {
                  if(cstmt!=null)  //close the connection
                  {
                      cstmt.close();
                      cstmt=null;
                  }
              }
              catch(SQLException ex)
              {
                  ex.printStackTrace();
              }
          }
      }
  }
  </code></pre>
  
  <p>My error message is:</p>
  
  <pre><code>com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 1.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildParamTypeDefinitions(SQLServerPreparedStatement.java:260)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildPreparedStrings(SQLServerPreparedStatement.java:219)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:612)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:400)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
      at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
      at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
      at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314)
      at com.first.mainapp.Sp.main(Sp.java:45)
  </code></pre>
  
  <p>What needs to be done if I want to use the stored procedure to validate a login</p>