Replace dataadapter by sql datareader

Is there any way I can replace the data adapter with sql reader to fill datatable.

 Dim SQLobj As New SqlCommand("L_Sy")
  SQLobj.Parameters.AddWithValue("@Title", Dy_Title)
            SQLobj.Parameters.AddWithValue("@Year_Ref1", Dy_Year_Ref1)
            SQLobj.Parameters.AddWithValue("@Year_Ref2", Dy_Year_Ref2)
            SQLobj.Parameters.AddWithValue("@FaxNumber", Dy_FaxNumber)
            SQLobj.Parameters.AddWithValue("@Attn", Dy_Attn)

    SQLobj.CommandType = CommandType.StoredProcedure
            SQLobj.Connection = sql.GetConnection

  Public Sub Populate(ByVal Command As SqlCommand)
        'Accept command as string and fill the datatable with the result of sql query
        ' Test_Str = "Test"
        Dim dt = New DataTable
            adapter = New SqlDataAdapter()
            adapter.SelectCommand = Command
            Data_Table = dt

        Catch MyException As SqlException
            MessageBox.Show("Stored procedure Error: MySQL code: " &
            MyException.Number & "  " &
        End Try
    End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Yes.  For each row in the reader add a new row to the data table and copy the contents of each field from the reader into the equivalent field in the new row in the table.

ps.  This is rather more code for you to write an could possibly run more slowly as well.
RIASAuthor Commented:
I read an article which prompts it will be faster:

var dataReader = cmd.ExecuteReader();
var dataTable = new DataTable();
RIASAuthor Commented:
Need to know how I can implement here.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

AndyAinscowFreelance programmer / ConsultantCommented:
You're right.  The Load method can use a datareader as the source (guess who hasn't ever done that).
In that case it is probably faster than using an adapter (a datareader is a lightweight class supporting limited functionality) but make certain the table and reader do match one another in terms of the columns of data.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Any suggestion in my code
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.