How do I assign a value to a variable from the SqlDataReader.Read() method?? In Visual Basic it was done like this:
VB Code:
while sReader.Read() Dim s As String = sReader("fieldnamefromdatabase") end while
I have tried converting this statement from VB to C# with no luck. Does anyone know how to perform this action.
I have tried a couple of other things as well but here is the one I tried first.
VB Code:
string s; while (sReader.Read == true) { s = sReader["fieldnamefromdatabase"]; }
Any help is appreciated!!




Reply With Quote