My client upgraded there sql server from 2000 to 2008.
Now for some reason, asp,net page that uses sqldatareader doesnt return any rows.
I put this code in vb.net just to see what it could be:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim myCommand1 As SqlCommand
Dim myDataReader1 As SqlDataReader
Dim strsql3 As String = "select * from table"
myCommand1 = New SqlCommand(strsql3, myConnection)
'''saw on a post to try this command; it didnt help either myCommand1.ExecuteNonQuery() 'executing the command and assigning it to connection
myDataReader1 = myCommand1.ExecuteReader()
MsgBox("in the while")
MsgBox("not in the while")
It doesn't get any data even though there is data in the database. I login to SSMS to verify the query that gets generated returns data.
I confirmed I was using the correct connection. Below is a sample connection string: Dim strConnection1 As String = "Data Source=Someip;Initial Catalog=TEST_Table;Persist Security Info=True;User ID=myuser;Password=stack;" When I change the Catalog to TEST_tables I get an error Cannot open database Test_tables requested by login. When I put it back to TEST_table I get no error. Also when I put a select to table that doesnt exist; I get invalid object name. So I know it going to the correct database.
When I put a break point on this code: myDataReader1 = myCommand1.ExecuteReader(); it executes but
hasrows = false