views:

32

answers:

1
dbReader = DAL.GetCaseSumCasesAssnCtrlMgmtCtrlChargeCodesLeftJoin(ClientKey, txtCaseNumber.Text)
If dbReader.Read Then
Try
  txtmgm.Text = dbReader.Item("MgmtCtrlpKey")
  HoldMGMKey = dbReader.Item("AssnCtrlpKey")
Catch ex As Exception
End Try

the exception is thrown at "AssnCtrlpkey"

A: 

It seems to me that your dbReader doesn't have the column you're requesting ("AssnCtrlpKey"). Check your database query for that column.

Your question is sufficiently vague, however, that it's a shot in the dark.

Mark
I checked executing the sql query in the stored procedure. I get the column at runtime. It is in some cases where it throws the error saying index is out of range.
sony
What class is dbReader?
Mark
it is IDatareader and declared as public in partial Class A (A is random name of the class.) in Namespace B.
sony
It seems clear that the column isn't there, or you're using some implementation of IDataReader that doesn't do what it's supposed to. It's clear from http://msdn.microsoft.com/en-us/library/1a8yx17k.aspx that Item(string) throws IndexOutOfRangeException when "No column with the specified name was found."
Mark
Ok what should I start to check. I checked the datareaders are being used a lot on the page to read the data.So initially I saw a single datareader is declared as public on top of the page and that is being called when needed and closed appropritately, but it doesn't seem to me as a best practice ,this might be reason for these kind of errors. I declared the same reader as local to each function in which it is being used.
sony
but still I find errors coming on production
sony
Sorry, there's not enough information to go on.
Mark