When using a DataReader object to access data from a database (such as SQL Server) through stored procedures, any output parameter added to the Command object before executing are not being filled after reading. I can read row data just fine, as well as all input parameters, but not output ones.
[This question is actually just for anyo...
I'm trying to populate a DataTable, to build a LocalReport, using the following:
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = new MySqlConnection(Properties.Settings.Default.dbConnectionString);
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT ... LEFT JOIN ... WHERE ..."; /* query snipped */
// prepare data
dat...
I am cleaning up the DataReaders in an old .NET 1.1 project that I inherited.
The previous developer coded the data-access-layer in such a way that most of the DAL methods returned SqlDataReaders (thus leaving it up to the caller to properly call the .Close() or .Dispose() methods).
I have come across a situation, though, where a cal...
When running the following code it leaves out one row. When I do a files.Count it says there are 4 rows but there is no data stored for the 4th row. When I run the stored procedure from within SQL Manager it returns all 4 rows and all the data. Any help?
List<File> files = new List<File>();
SqlConnection active_c...
How do I mock the method GetValues() in System.Data.IDataReader?
This method changes the array of objects passed to it, so it can’t simply return a mocked value.
private void UpdateItemPropertyValuesFromReader( object item, IDataReader reader )
{
object[] fields = new object[ reader.FieldCount ];
reader.GetValues( fields ); //...
Which would be quicker.
1) Looping a datareader and creating a custom rows and columns based populated datatable
2) Or creating a dataAdapter object and just (.Fill)ing a datatable.
Does the performance of a datareader still hold true upon dynamic creation of a datatable?
...
I am having trouble retrieving results from my datareader in visual studio 2008. I have several stored Procs in the same database. I am able to retrieve values from those that dont receive input parameters. However, when i use the executreReader() method on a stored proc with input parameters i get an empty datareader. Upon examining the...
I have code that looks like:
//System.Data.IDataRecord dr
try
{
Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
}
catch (IndexOutOfRangeException) { } //swallow
I don't know if the consolidated column will be present in the datareader, so I do that to check, works fine (little hackish...
This method returns some strange results, and was wondering if someone could explain why this is happening, and possibly a solution to get my desired results.
Results:
FileName = what I'd expect
FileSize = what I'd expect
Buffer = all bytes = 0
BytesRead = 0
BlobString = string of binary data
FieldType = BLOB (what I'd expect)
Co...
This could be an sql server database setup issue, but I am not to sure where to start looking.
I have a stored procedure :
CREATE PROCEDURE aStoredProcedure
@dteSince DATETIME = null
AS
...
The c# code to call the stored procedure is :-
using (IDataReader dr = database.ExecuteReader("aStoredProcedure"))
{
...
The c# code works fin...
I am manually calling a stored procedure using an Entity Framework EntityConnection like so:
DbConnection storeConnection = entityConnection.StoreConnection;
DbCommand command = storeConnection.CreateCommand();
command.CommandText = "sp_GetMyComplexData";
command.CommandType = CommandType.StoredProcedure;
DbDataReader reader = command....
I am trying to hydrate a list of ~400 business objects and the performance becomes very slow when it needs to hydrate strings. It's taking in excess of 20secs to hydrate the 400 objects.
EDIT
We are using MySQL 5.1 and dotConnect for MySQL v5.0.12 as the data provider http://www.devart.com/dotconnect/mysql/
I did some benchmarks to na...
It seems folks have lost the ability to generate old style COBOL/RPG reports using modern day languages.
I often see code using DataReaders that relies on a count of records. So an additional aggregrate query is present when it need not be.
In most circumstance this code needs to know if there is another record available or not. In o...
In my ASP MVC application I'm using standard SQL (rather that Linq to SQL or other ORM) to query my database.
I would like to pass the database results to my view and iterate over the results in my view. But I'm not sure how to do this. Every example I've seen passes some string or uses L2S. I would like to pass something like neste...
Hi
I have a stored procedure that returns two recordsets which i call using GetReader. I iterate the first, call IDataReader.NextResult(), then iterate the second.
I assign values to output parameters in the sp, but when i check the values after finishing with my reader, my output parameters are null. Looks like a bug. I don't want to ...
If i run a TSQL Statement in management studio and run the same the query through SqlDataReader, the latter gives the result faster than the former...
Any reason??
...
I've been tasked to create a class that clients can use to get data from a specific data source. For example, the main routines will be
IDataReader GetDataReader(DbCommand command);
DataSet GetDataSet(DbCommand command);
I know that the Data Access Application block does this but I can't use the application block for reasons I won't...
Hi, looking for help and need pointing in the right direction, can anyone assist?
Have a data file (txt) that contains 10000 numbers/data points. Storing the data file as varbinary(MAX) in an SQL table.
My goal is to retrieve the file on user request and plot/chart the numbers as a line chart.
No problem in getting DataReader to displ...
Hello,
I am looking to develop a website for a news channel.
So, Obviously its gonna receive a lot of hits daily and will be updated a lot on daily basis..
I have experience in ASP.Net and SQL Server..
These are the technologies i am considering to work with. Please help me choose the right method considering the amount of load it w...
I've got a Winform app that will be used in the US and China. The SQL Server 2005 database is in the US, so the data access is going to be slower for the people in China. I'm deciding between using a DataReader and a Dataset for best performance. The data will immediately be loaded into business objects upon retrieval.
Question: Which p...