|
|
|
start date: Mon, 20 Aug 2007 23:42:16 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
ary
|
|
2
Ladislav Mrnka
|
|
3
ary
|
|
4
Aidy
|
|
5
ary
|
DataReader with Datatable Vs Dataset
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?
Date:Mon, 20 Aug 2007 23:42:16 -0700
Author:
|
RE: DataReader with Datatable Vs Dataset
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
"ary" wrote:
> 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?
>
>
Date:Tue, 21 Aug 2007 00:20:01 -0700
Author:
|
Re: DataReader with Datatable Vs Dataset
On Aug 21, 10:20 am, Ladislav Mrnka
wrote:
> 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
>
>
>
> "ary" wrote:
> > 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 than a data Set 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?- Hide quoted text -
>
> - Show quoted text -
Thanks , Ladislav
Date:Tue, 21 Aug 2007 00:27:32 -0700
Author:
|
Re: DataReader with Datatable Vs Dataset
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.
"ary" wrote in message
news:1187678536.741820.139090@57g2000hsv.googlegroups.com...
>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?
>
Date:Tue, 21 Aug 2007 09:34:50 +0100
Author:
|
Re: DataReader with Datatable Vs Dataset
On Aug 21, 11:34 am, "Aidy" wrote:
> 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.
>
> "ary" wrote in message
>
> news:1187678536.741820.139090@57g2000hsv.googlegroups.com...
>
>
>
> >I use a dataread to read data with high performance From database ,
> > but I have some question about this .
>
> > I usedatatableto insertdatareaderitem intoDataTable, 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 indataset to make it slower thandatareader?- Hide quoted text -
>
> - 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.
Date:Tue, 21 Aug 2007 03:29:10 -0700
Author:
|
|
|