DataReader with Datatable Vs Dataset

A

ary

I use a dataread to read data with high performance From database ,
but I have some question about this .

I use datatable to insert datareader item into DataTable , Is this
Consistently Better that a data reader or not?


Dim ArticleTable As New Data.DataTable

ArticleTable.Columns.Add("ArticleID",
Type.GetType("System.Int32"))
ArticleTable.Columns.Add("ArticleTitle",
Type.GetType("System.String"))
ArticleTable.Columns.Add("ArticleBody",
Type.GetType("System.String"))
ArticleTable.Columns.Add("ArticleDateCreated",
Type.GetType("System.String"))

..
..
....


Dim reader As SqlDataReader = Command.ExecuteReader()

While reader.Read()

row = ArticleTable.NewRow()

row("ArticleID") = reader("ArticleID")
row("ArticleTitle") = reader("ArticleTitle")
row("ArticleBody") = reader("ArticleBody")
row("ArticleDateCreated") = (reader("ArticleDateCreated"))


ArticleTable.Rows.Add(row)

End While


What is Happend in dataset to make it slower than datareader?
 
G

Guest

Hi Ary,
I think performance in your case will be same. I'm usually using DataReader
when I want to immediatelly use data some how. If I want to persist data
(never mind how long time) I'm using DataAdapter with DataTable or DataSet.

Regards,
Ladislav
 
A

ary

Hi Ary,
I think performance in your case will be same. I'm usually using DataReader
when I want to immediatelly use data some how. If I want to persist data
(never mind how long time) I'm using DataAdapter with DataTable or DataSet.

Regards,
Ladislav











- Show quoted text -

Thanks , Ladislav
 
A

Aidy

For inserting data you should use an INSERT SQL statement. If you're using
SQL Server then a stored procedure that does the INSERT would be best.

This might get you started;

http://support.microsoft.com/kb/308049

I had a google around but couldn't really find any simple examples.
 
A

ary

For inserting data you should use an INSERT SQL statement. If you're using
SQL Server then a stored procedure that does the INSERT would be best.

This might get you started;

http://support.microsoft.com/kb/308049

I had a google around but couldn't really find any simple examples.












- Show quoted text -

not insert data I want to Select Data.

I just want to khow If I use a datatable in conjuction with a sql
datareader, would this still be faster in performance than using a
dataset?

If so why?

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top