cmgarnett 0 Newbie Poster

Hi All

I am having a problem that's driving me crazy.

I've just moved a .Net 2 website to run on .Net 4. The conversion went without any problems and everyting runs well on my development machine in both its raw and built forms.

But... when I move the site to the live server it crashes whenever I try to bind a datareader to a GridView or Repeater control.

In my code I can create the SQL command and execute it. I can set the data source for the control to be my datareader but when I use the databind command - bang!

I'm told by the hosts that their permissions are set up the same for both .Net 2 and .Net 4, so that shouldn't be a problem. They run their servers at medium trust level.

This is the code that I use for creating the datareader.

oCmd.CommandText = sSQL
oConn.Open()
oReader = oCmd.ExecuteReader(CommandBehavior.CloseConnection)
oDR = oTable.GetDataReader(sSQL)
With gvUserPensions
  .DataSource = oDR
  .DataBind()
End With

The rather unfriendly errors I am getting are :-

Exception Details: System.Exception: Attempt by method 'Microsoft.VisualBasic.CompilerServices.Symbols+Container.InvokeMethod(Method, System.Object[], Boolean[], System.Reflection.BindingFlags)' to access method 'System.Data.Common.DataRecordInternal.get_Item(System.String)' failed.

Has anyone else run into a similar problem?