Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my table:
Quote:
@abc as tinyint = 0,

@ADINCI01 as int
@ADINCI02 as smalldatetime
@ADINCI03 as int
@ADINCI04 as smallint
@ADINCI05 as decimal(14,8)
@ADINCI06 as decimal(14,8)
@ADINCI07 as smallint
@ADINCI08 as varchar(30)
@ADINCI09 as varchar(300)
@ADINCI10 as varchar(300)
@ADINCI11 as bit
@ADINCI12 as smalldatetime
@ADINCI13 as smallint
@ADINCI14 as varchar(20)


i call the store procedure in sql, in this way:
Quote:
exec SP_INCIDENCIAS 1 ,0,'20191217',3931,99,45.2345678,-100.456778,1,'Texto 1','Texto 2','',1,'20191215',1,'IMEI7722666633'

and works


i have proble to move this to android...sorry im beginner
public void CallSP(){

        try
        {

            connectionClass = new ConnectionClass(); //the class file
            Connection con = connectionClass.CONN();
            if (con == null)
            {
                toast2("ERROR DE ACCESO A INTERNET");
            }
            else
            {
                String sql="{call SP_INCIDENCIAS (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
                CallableStatement cs= con.prepareCall(sql);
           
                Date date=new Date();
                cs.setInt(       1,1);
                cs.setInt(       2,0);
                cs.setDate(      3, java.sql.Date.valueOf("20191217"));
                cs.setInt(       4, 3931);
                cs.setInt(       5, 99);
                cs.setDouble(    6, 45.2345678);
                cs.setDouble(    7,-100.456778);
                cs.setInt(       8,1);
                cs.setString(    9,"Text1");
                cs.setString(    10, "Text2");
                cs.setString(    11, "1");
                cs.setInt(       12,1 );//bit
                cs.setDate(      13, java.sql.Date.valueOf("20191215"));
                cs.setInt(       14,1);
                cs.setString(    15,"IMEI7722666633");
                cs.execute();

                cs.close();
                toast1("INCIDENCIA GUARDADA");
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }


What I have tried:

im having problems to call the store procedure from android, sorry im beginer on this
Posted
Comments
Richard Deeming 19-Dec-19 8:25am    
"Having problems" is not enough information for anyone to help you. You need to describe what's happening, including the full details of any exceptions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900