Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
GeneralRe: Byte arrays to pdf Pin
RaviRanjanKr25-Feb-11 18:03
professionalRaviRanjanKr25-Feb-11 18:03 
QuestionSqlDataReader vs. SqlDataAdapter Pin
Dewald22-Feb-11 19:26
Dewald22-Feb-11 19:26 
AnswerRe: SqlDataReader vs. SqlDataAdapter PinPopular
OriginalGriff22-Feb-11 20:56
mveOriginalGriff22-Feb-11 20:56 
GeneralRe: SqlDataReader vs. SqlDataAdapter Pin
Dewald22-Feb-11 21:20
Dewald22-Feb-11 21:20 
GeneralRe: SqlDataReader vs. SqlDataAdapter Pin
PIEBALDconsult23-Feb-11 2:15
mvePIEBALDconsult23-Feb-11 2:15 
GeneralRe: SqlDataReader vs. SqlDataAdapter Pin
Dewald23-Feb-11 2:28
Dewald23-Feb-11 2:28 
AnswerRe: SqlDataReader vs. SqlDataAdapter Pin
Wayne Gaylard22-Feb-11 21:15
professionalWayne Gaylard22-Feb-11 21:15 
AnswerRe: SqlDataReader vs. SqlDataAdapter Pin
PIEBALDconsult23-Feb-11 2:06
mvePIEBALDconsult23-Feb-11 2:06 
I always use a DataReader, never a DataAdapter or DataSet. In my opinion, DataAdapters, DataSets, and DataGrids were developed to allow Microsoft presenters to very quickly query, display, and update simple data and get an "oooh" from the crowd. They are fine for prototyping, but are not suitable for production enterprise applications. DataAdapters are very limited in what they can do and actually try to do too much -- e.g. optimistic concurrency[^].

The few times I've been lazy and used a DataAdapter in a real scenario, it bit me and I had to rework the code to use a DataReader instead.

Also, bear in mind that in ADO.net, all data access goes through a DataReader -- ExecuteScalar, ExecuteNonQuery, DataAdapter.Fill, and DataAdapter.Update all use ExecuteReader to perform the tasks.

ExecuteReader can be used to execute any SQL statement your database accepts -- queries, DML, and DDL. And, in some cases (SQL Server) you can pass a semi-colon delimited list of SQL Statements (though it doesn't report the results of non-queries the way I'd like Dead | X| ).

By using a DataReader you can reduce your application's memory footprint when you don't need to have all the records in memory at the same time. Or you can fill a collection of custom objects rather than a DataTable. Or you can fill a DataTable your own way and avoid the DataAdapter's overhead.


DataGrids and DataGridViews are rarely an appropriate control for displaying and editing data in real situations.
QuestionJunk data Display on Page Load Pin
Devkranth Kishore Vanja22-Feb-11 17:37
Devkranth Kishore Vanja22-Feb-11 17:37 
AnswerRe: Junk data Display on Page Load Pin
_Maxxx_22-Feb-11 18:29
professional_Maxxx_22-Feb-11 18:29 
GeneralRe: Junk data Display on Page Load Pin
Devkranth Kishore Vanja22-Feb-11 19:19
Devkranth Kishore Vanja22-Feb-11 19:19 
AnswerRe: Junk data Display on Page Load Pin
Bernhard Hiller22-Feb-11 20:05
Bernhard Hiller22-Feb-11 20:05 
GeneralRe: Junk data Display on Page Load Pin
Devkranth Kishore Vanja22-Feb-11 20:16
Devkranth Kishore Vanja22-Feb-11 20:16 
GeneralRe: Junk data Display on Page Load Pin
Bernhard Hiller22-Feb-11 20:47
Bernhard Hiller22-Feb-11 20:47 
GeneralRe: Junk data Display on Page Load Pin
Devkranth Kishore Vanja22-Feb-11 22:15
Devkranth Kishore Vanja22-Feb-11 22:15 
Questionanimation Pin
jashimu22-Feb-11 9:58
jashimu22-Feb-11 9:58 
AnswerRe: animation Pin
Luc Pattyn22-Feb-11 10:15
sitebuilderLuc Pattyn22-Feb-11 10:15 
GeneralRe: animation Pin
musefan23-Feb-11 5:10
musefan23-Feb-11 5:10 
AnswerRe: animation Pin
PIEBALDconsult22-Feb-11 10:31
mvePIEBALDconsult22-Feb-11 10:31 
GeneralRe: animation Pin
jashimu22-Feb-11 10:35
jashimu22-Feb-11 10:35 
GeneralRe: animation Pin
PIEBALDconsult22-Feb-11 13:40
mvePIEBALDconsult22-Feb-11 13:40 
AnswerRe: animation Pin
_Maxxx_22-Feb-11 18:33
professional_Maxxx_22-Feb-11 18:33 
GeneralRe: animation Pin
jashimu23-Feb-11 2:45
jashimu23-Feb-11 2:45 
QuestionHow to embed variable value in sqldatasource session parameter in c# Pin
Member 471627122-Feb-11 8:31
Member 471627122-Feb-11 8:31 
AnswerRe: How to embed variable value in sqldatasource session parameter in c# Pin
Richard MacCutchan22-Feb-11 23:19
mveRichard MacCutchan22-Feb-11 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.