• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resultset does not return any result from SQL Server 2012 View or Table

 
Alireza Azadi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

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

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?
 
Ron McLeod
Bartender
Pie
Posts: 1049
65
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alireza Azadi wrote:When I press the button it should print the I variable, but it does nothing.

What do you mean does nothing? Line 7 should execute and you should see your Toast pop-up regardless of how many rows are returned. Have you checked LogCat for any messages?
 
Alireza Azadi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron McLeod wrote:
Alireza Azadi wrote:When I press the button it should print the I variable, but it does nothing.

What do you mean does nothing? Line 7 should execute and you should see your Toast pop-up regardless of how many rows are returned. Have you checked LogCat for any messages?


Im really confused.
Cause of this i say it does nothing.
It does not show my Toast !
and anything.
But when i select from View_2 it shows the index of View_2.
Can it be cause of 28,000,000 row of the table that View_4 use??
 
Ron McLeod
Bartender
Pie
Posts: 1049
65
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how long you are waiting, but transporting 28 million rows through your Android device's network connection might take some time.

If you just want to display how many rows match don't fetch the data, just get a count - try something like this:

Edit: made a change to the code example.
 
Alireza Azadi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron McLeod wrote:I'm not sure how long you are waiting, but transporting 28 million rows through your Android device's network connection might take some time.

If you just want to display how many rows match don't fetch the data, just get a count - try something like this:


No, i want to get some data from this,But i divided it to this.
At first i wanted to call Stored Procedure that uses the Table.
I could not, i migrate to View.
And again i could not,Now i want directly read data from this table.( That Stored Procedure and View uses the table i directly connect now)
I want to see that if it goes to ResultSet loop or not.
If i get result from this,i could get satisfied data from the table.
I was agree with you,So that i wait for 3 minutes.
I tried top 10 in my statement, but no chance.
And also tried some simple queries that SQL Server Management Studio execute in 3 or 4 seconds.
And again no chance.
 
Ron McLeod
Bartender
Pie
Posts: 1049
65
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alireza Azadi wrote:I want to see that if it goes to ResultSet loop or not.

Put a Log statement inside the loop and check the LogCat output.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic