-1

I wanted to extract data on sql and store them in a temporary table using Netbeans.How can i do it? I have this situation:

 String SQL = " select name,age into #person from registry ";
 ps = con.createStatement();
 rs= ps.executeQuery(SQL);

but i have this exception:

com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.

luana nastasi
  • 29
  • 1
  • 4

1 Answers1

0

The exception says you did not return anything and yet you try to do rs= ps.executeQuery(SQL); . try rs= ps.execute(SQL);.

PS : execute(sql): Returns true if the first object that the query returns is a ResultSet object. Use this method if the query could return one or more ResultSet objects. This method can be used for all types of SQL statements. If you don’t know which method to use for you SQL statements, then this method can be the best option. This method returns a boolean value. TRUE indicates that statement has returned a ResultSet object and FALSE indicates that statement has returned an int value or returned nothing.

parlad
  • 1,143
  • 4
  • 23
  • 42