Reputation: 178
I'm using java with an MS Access database.
When I try to search the data in the database I get this message:
java.sql.SQLException: No data found
in my database a row is empty, the database looks like this:
DATA_TO_READ
1-->string1
2-->string2
3-->
4-->string4
The error message appears when I try to read line 3. I think it's normal because there is no data. This is why I make a verification in order to know if there is some data:
while(data.read())
{
ExtractString = (data.getString("DATA_TO_READ")!=null) ? data.getString("DATA_TO_READ") : "";
}
But even with this verification I still have the same issue.
Does someone have any idea how to solve this issue?
Upvotes: 1
Views: 2463
Reputation: 1259
You try to read the value of a column multiple times.Change the code like that :
while(data.read())
{
String val = data.getString("DATA_TO_READ");
ExtractString = (val !=null) ? val : "";
}
Upvotes: 2