Previously, I connected to SQL Server 2012 Views and Tables properly, but few days ago, I tried to select from a Stored Procedure, with the help of my good friends here, but no chance. So i forgot about Stored Procedure and tried a View. I want to select data from a View. Here is my code:
statement = connectionHelper1.getMyConnection().createStatement();
ResultSet resultSet = statement.executeQuery("select Latitude from View_4 where IMEI='xxxxx'");
while (resultSet.next())
{
i++;
}
Toast.makeText(getApplicationContext(), " : " + i, Toast.LENGTH_SHORT).show();
This code is in button.setOnClickListener
method. When I press the button it should print the I variable, but it does nothing.
But when I print this Query in SQL Server 2012 query mode, it returns the values and Resultset works. (I mean this select query)
I should say that this View(View_4) by itself select from a table that has about 28,000,000 row!!
But when I select from another View named View_2 and select some other fields related to this View(View_2), it returns the I and ResultSet.
Notice that View_2 is another View and contains different fields from View_4.
Like this:
statement = connectionHelper1.getMyConnection().createStatement();
ResultSet resultSet = statement.executeQuery("select Latitude from View_2 where name='xxxxxxx'");
while (resultSet.next()) {
i++;
}
Toast.makeText(getApplicationContext(), " : " + i, Toast.LENGTH_SHORT).show();
The code below returns values and result from query,then it prints the I. But in first code that I have used View_4 it does not work. I notice again that the View_4 returns value from a table that has 28,000,000 rows. So I decided to select from that table directly, but still can not select from that table. Can the number of rows be the cause. If yes what can I do?