Help with dats sql server and android

0

I have this code to do a search to SQL Server database but give me error:

  

Incorrect syntax near '19'

Here is the search code:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
String currentDateandTime = sdf.format(new Date () );
System.out.println(currentDateandTime);


if (conn == null) {

Pesquisa = "Não foi possivel se conectar ao banco de dados";

} else



if (conn != null) try {


Statement statement = conn.createStatement();

String queryString =  " Select SUM(DIFERENÇA)as somaMes from TOTALIZADOR WHERE  NID = 252 and DATAHORA  >= "+currentDateandTime+" and DATAHORA = "+currentDateandTime+" ";
ResultSet rs;
    
asked by anonymous 10.07.2017 / 21:36

0 answers