ExecuteScalar and SqlDataAdapter.Fill Behave different for same query?

A DataAdaptor consumes all datasets that come back from the client. An exception is a dataset too ExecuteScalar consumes the 1st row, 1st column, 1st dataset only Don't use ExecuteScalar Keep consuming DataReaders until you get no more back Use DataAdaptor. Fill (DataSet).

It will skip exceptions for filling DataTables too.

A DataAdaptor consumes all datasets that come back from the client. An exception is a dataset too. ExecuteScalar consumes the 1st row, 1st column, 1st dataset only.

Don't use ExecuteScalar Keep consuming DataReaders until you get no more back Use DataAdaptor. Fill (DataSet). It will skip exceptions for filling DataTables too.

Interesting, makes a lot more sense now. So my stored procedure is creating a result before it gets to the error, so even though the error happens its ignored. – Kratz Jul 8 at 16:15 @Kratz: yes, exactly.

We hit the same errors for ExecuteScalar (changed to outpit parameters), ExecuteReader (changed to consume until no more DataReaders) and DataAdaptor/DataTables (changed to use DataSets). Its pretty poor, really... – gbn Jul 8 at 16:18.

.ExecuteScalar() return the first value returned, be it a value from your stored procedure, or the error code generated by your stored procedure. The fill command is expecting data to be returned and an error in sql throws an exception.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions