Re: making datareaders

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Here's an example of what we do.

We execute the sql query to get a datareader back then pass that
datareader into a method to fill and object (or it could be an array)
and return that object:

Private Function FillUserObect(rdr As SqlDataReader) As User
Dim u As New User()

u.Id = rdr.GetInt32("Id")
u.Name = rdr.GetString("Name")

'More lines for the rest of the fields here

Return u
End Function


You can also use the data reader's GetValues method to fill an object
array with the values.

.



Relevant Pages

  • Re: SQL query from an array in VB.NET
    ... > I'm tying to create a SQL query from an array i've created ... Do you want to execute the query /on/ the array or do you want the ...
    (microsoft.public.dotnet.languages.vb)
  • Whether to use a hashtable, datareader, array, dataset, or Datatab
    ... I am wondering what type of control I should use for iterating through the ... IDataReader dataReader = null; ... DBCommandWrapper dbCommandWrapper = ... So, should I use a datareader, dataset, datatable, array, or hashtable to ...
    (microsoft.public.dotnet.general)
  • Re: DataReader and JOIN query
    ... you can't make a simple sql query for that. ... Software Developer & Consultant ... Microsoft MVP ... this kind of model wouldn't work well with DataReader, ...
    (microsoft.public.dotnet.framework.aspnet)
  • REF CURSOR returns no rows
    ... My DataReader does not contain any ... I execute the SELECT statement in TOAD/ SQL PLUS and that works fine. ... Is there any limitations in returning complex selects in a REF CURSOR? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DataTable values
    ... it dowes seem that you may be wasting some cycles ... as you want your data put into an array. ... efficient to use a DataReader to create your array. ... > one of the DataTable columns. ...
    (microsoft.public.dotnet.framework.aspnet)