all groups > sql server connect > december 2004 >
You're in the

sql server connect

group:

Odd results from query



Odd results from query Dave
12/20/2004 12:29:05 PM
sql server connect: The environment is ASP.Net accessing the SQL server through IIS.

While, I've been told that .Net does not create a cache the behavior I'm
observing for intensive purposes looks as if there is a cache. I'm at a bit
of a loss to explain this behavior. Also, if I wait five or ten minutes, and
refresh I get the correct value.

I have a stored procdure that returns a series of rows, from which I sum a
particular number.

There is an action which causes another row to be added.

However, when I make this change to the database the change is not returned
in a query immediatly following the update. I have simultaneously run sql
query analyzer and verified that the table was updated correctly.

When the form is first displayed and then shortly after I perfomr the update
the value is recalculated via the following mechanism:

Using the global connection string a new SqlConnection object is built. Then
a new SqlCommand object is built using the new SqlConnection. The command
type is stored procedure. After the SqlCommand is setup (the command text and
parameters filled in), a new SqlDataAdapter is built using the SqlCommand.
The SqlDataAdapter fills a new DataSet, via the Fill method.

When I say that the object is new I mean that literally, as in
SqlCommand cmd = new SqlCommand (ConnectionString);

I would very much like to get the correct result right away.

Thanks,
RE: Odd results from query brian
1/7/2005 8:31:05 AM
I think you should share more details about the nature of your stored proc.
Are any parameters being passed to the procedure? When you say 5 or 10
minutes have passed before it returns the correct sum, are you using the same
active browser window, or are you starting a new browser (thus starting a new
session, and perhaps refreshing the state with the server, thus passing new
parameters to the procedure).

Just a guess - I'm probably way off and you probably already thought of all
that :)

Brian

[quoted text, click to view]
AddThis Social Bookmark Button