Questions tagged [dbdatareader]
32 questions
1
vote
1 answer
Get query result from NpgsqlDataReader
This is my function:
public int gtCountCertificatByExercice()
{
DataTable resDataTable = new DataTable();
DBConnection dbConnection = new DBConnection();
string query = "SELECT COUNT(id) AS nb_cert " +
"FROM…

Slim EN
- 145
- 2
- 3
- 9
1
vote
3 answers
With dbDataReaders and "Using" do you still need to call Close?
Ok, If I put a dbDataReader in a "Using" statement do I still need to explicitly call the dbDataReader.Close. In the .net documentation it says that "Using" a connection automatically Closes it. In the example below from MSDN it shows a…

dblwizard
- 595
- 7
- 26
0
votes
2 answers
MYSQL secure-file-priv set to blank, but when running DbDataReader ExecuteReader it is acting like it is not
I have set secure-file-priv="" in the my.ini file
And if I run my SQL chunk inside MySQL WorkBench it works perfectly.
However when C# actually runs the DbDataReader ExecuteReader I get an error back in return. The error is telling me that that file…

Mi-krater
- 299
- 1
- 3
- 16
0
votes
0 answers
Wrong number or types of arguments in call to 'Function'
I have a function that is in a package in Oracle. It takes the job name and after associating with the table, it returns a number of 0 or 1.
In my code this is how I pass the job name to the function:
checkJob =…

CodingNeeded
- 111
- 1
- 10
0
votes
1 answer
ADO.Net - Having multiple DBDataReaders running at the same time?
When I have multiple DBDataReaders reading data at the same time I get the following error:
There is already an open DataReader associated with this Connection which must be
closed first
I have ConnectionPooling enabled in my config so I don't…

aryaxt
- 76,198
- 92
- 293
- 442
0
votes
3 answers
How best to loop over a batch of Results with a C# DbDataReader
I'm executing a number of SQL query's as a batch and then getting all of the result sets back in a batch. The way that my code is currently put together, the first result set gets skipped. Now that I know this, I could simply throw in another…

Brian Sweeney
- 6,693
- 14
- 54
- 69
0
votes
1 answer
How to easily convert a DbDataReader object into something useful?
I am manually calling a stored procedure using an Entity Framework EntityConnection like so:
DbConnection storeConnection = entityConnection.StoreConnection;
DbCommand command = storeConnection.CreateCommand();
command.CommandText =…

John B
- 20,062
- 35
- 120
- 170
0
votes
1 answer
using GetFieldValueAsync with type from GetFieldType
I have a generic reader and I want to transform it from sync to async.
The original code is
while (DR.Read())
{
count++;
Field[] fields = new Field[DR.FieldCount];
for (int i = 0; i < DR.FieldCount; i++)
{
Field field = new…
user11323942
0
votes
1 answer
Return sql query results with deferred execution
I have a method to execute an SQL statement and it returns an instance of my class ResultSet that contains the rows and columns returned. I only want to read the data row-by-row when the caller actually iterates over the results.
public class…

user3700562
- 693
- 11
- 23
0
votes
0 answers
SQLite (.NET), 8 bytes double is converted to 'infinity' rather than double.MaxDouble as inserted?
I am using the SQLite .NET library to save doubles
This is my pseudo-code
// create table t1 (value REAL)
// ... connect to db
var sql = $"insert into t1(value) VALUES ({double.MaxValue:G64})"; // insert into t1(value) VALUES…

Simon Goodman
- 1,174
- 1
- 8
- 35
0
votes
0 answers
How to load a table per hierarchy type from a DbDataReader with entity framework?
I tried calling ObjectContext.Translate where T is the abstract base type of a table-per-hierarchy entity. If the DbDataReader is streaming back all the columns of the underlying table, I thought this method would be able to construct the…

Triynko
- 18,766
- 21
- 107
- 173
0
votes
0 answers
hadoop DbDataReader.GetValue gets wrong timestamp
i'm querying an hadoop cluster with DbDataReader.GetValue in c#.
the problem is that i'm getting a wrong value on timestamp.
The value in hdfs file (and when querying via hive) is
1997-03-21 01:00:00
But with DbDataReader.GetValue i'm getting…

user2482703
- 151
- 2
- 13
0
votes
1 answer
Error while read data from database using DbDataReader
I want to read data from an oracle database and add that data in to a List. But when I run the application I'm getting the 'Invalid operation. The connection is closed.' error.
This is my code:
public class NewOtherCompanyMapper
{
OtherCompany…

Madushi
- 1
- 2
- 5
0
votes
0 answers
how to have indexer object containing data of a database row without DataRow/DataReader in C#
I'm currently having 2 wrapper classes to contain DataReader and DataRow, respectively. The wrapper classes implement same interface IIndexer. They are used because I have lots of methods that just indexes the columns to get the values:
Here is the…

char m
- 7,840
- 14
- 68
- 117
0
votes
2 answers
"No data exists for the row/column" exception after using ToList
I have an extension method to convert a DbDataReader to an IEnumerable object:
public static IEnumerable AsEnumerable(this DbDataReader reader) {
while (reader.Read()) {
yield return reader;
}
}
In my application, I…

David Brown
- 35,411
- 11
- 83
- 132