apologies if this is not a good place to post this, but we are experiencing some very strange things with our web ap which is running on a SQL 2005 instance.
the application is a .net web app and does as you would expect a number of queries throughout the day.
but intermittently we are getting errors such as Exception message: *DataBinding: ‘System.Data.DataRowView’ does not contain a property with the name ‘column_name’*. when it clearly does have that column in the query – which if run by hand works fine.. is this a symptom of the SQL instance maybe running out of memory or just being generally poorly?
certainly we cannot track any problems in the code!
unfortunately both the web app and SQL instance are on the same box which is a Xeon with 4GB of ram, so by no means uber powerful..
ps. its not just queries like the above that seem to fall over, but some linq-to-sql things to, in fact it goes through phases of not liking the DB at all.. any help/suggestions would be happily received
thanks
nat
some code.. cant see anything wrong with the below.. but the exception above is basically saying cant find column a or b or c…
Dim conn As New SqlConnection(sitedb)
Dim cmd As New SqlCommand
cmd.CommandText = "SELECT a,b,c FROM Table"
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable
Try
conn.Open()
da.Fill(dt)
Catch ex As Exception
Throw ex
Finally
conn.Close()
End Try
if dt.Rows.Count > 0 then
Grid.DataSource = dt **<- dies here....**
Grid.DataBind()
end if
how can it return rows from a query that clearly works and then throw an indexoutofrange on a column its just grabbed?
the real issue I think is that none of the problems we are experiencing are code related.. the db seems to go through a times of throwing wobblies and we experience a number of strange exceptions that dont seem to make sense. could this be resource related, as in if the box is underpowered, or ..?
You are issuing Conn.Close so I presume the recordset is disconnected. However, the db library’s cursor location determines if rows are pulled at execution time or fetch time, and this can be a db-session-level or connection-level setting.
Is there any chance that connection pooling or some other parallel behavior is causing your recordset to not be fetched due to being implicitly in server-side-paging mode?
Try keeping the connection open while you use the dataset and if that solves it then you know to keep barking up this tree.