Ok - I'm using a simple SqlDataReader like this:
Simple stuff - using for example: .FieidlCount, .HasRows, .GetName and more important, the default method which just returns a field (rsPrint(0) near the bottom of that code snippet).
What I'm looking to do is allow for this existing SQL access - calling that ExecuteReader at the top to work but also allow the "source" of the data to be a local array.
I'm thinking I can "override" each method and property to either "call the underlying" SqlDataReader code, or "use" my own code that is managing the local array instead.
I'm looking to not change any of the code in this Using Block - basically transparently source rsPrint from two different places.
I know how to do this in JavaScript - and believe I've seen it done here before.
I'm using VS 2012 unfortunately.
TIA! Steve
Code:
Using rsPrint As SqlDataReader = cmd.ExecuteReader
ReDim strRS(0 To rsPrint.FieldCount - 1, 0 To 2)
If Not rsPrint.HasRows Then
.
.
.
If rsPrint.HasRows Then
If rsPrint.GetName(0) = "%%errormessage%%" Then
strErrorMessage = rsPrint(0)
Exit Do
End If
End If
What I'm looking to do is allow for this existing SQL access - calling that ExecuteReader at the top to work but also allow the "source" of the data to be a local array.
I'm thinking I can "override" each method and property to either "call the underlying" SqlDataReader code, or "use" my own code that is managing the local array instead.
I'm looking to not change any of the code in this Using Block - basically transparently source rsPrint from two different places.
I know how to do this in JavaScript - and believe I've seen it done here before.
I'm using VS 2012 unfortunately.
TIA! Steve