Questions tagged [executereader]

A Microsoft .NET method that sends the `CommandText` to the `Connection` and builds a `SqlDataReader`.

Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)

public SqlDataReader ExecuteReader()

Return Value

  • Type: System.Data.SqlClient.SqlDataReader
  • A SqlDataReader object.

http://msdn.microsoft.com/en-us/library/9kcbe65k(v=vs.110).aspx

128 questions
0
votes
1 answer

C# MySQL ExecuteReader

I have a problem with my C# project. I use a MySQL database and I use the MySQL Connector driver from MySQL Website but I have a problem with the cursor and the connexion. Indeed, Visual Studio says that is impossible to read data from a second…
nboulfroy
  • 201
  • 3
  • 14
0
votes
3 answers

C# write select from mysql to variable

I have a big problem with save variable from select in mysql. I wrote the following code: string connectionstring = @"****;userid=*****; password=***;database=***"; cnn = new MySqlConnection(connectionstring); cnn.Open(); MySqlDataReader reader =…
Michael
  • 202
  • 1
  • 3
  • 13
0
votes
1 answer

Ado.Net ExecuteReader with a read-only SQL Server user

At the Application_Start of my web site I execute a stored procedure to read some data from one SQL Server 2008 database. This is the only call to this database. I would create a specific SQL Server user, with read-only permission, to exec this…
opaera
  • 1
0
votes
1 answer

MySql to .txt in C# WPF

I am trying to get a table from my local database to download into a .txt. I've and I'm honestly at a loss. It has to be in a txt for simplicity of other users. I've tried a few different ways, I've tried to call it as if I was writing it to a…
Mokey
  • 215
  • 1
  • 15
0
votes
1 answer

Mysqlcommand.ExecuteReaderAsync handle stored procedure that can return one or more result sets

I have a stored procedure that could return 2 sets of results if there were no errors. The first set is just a normal select. The second set contains the error code and error message, this set will always return one row. Since there was no error,…
Vibol
  • 615
  • 1
  • 8
  • 25
0
votes
1 answer

Save delimited string from SQL query as string array

I am hoping to provide just enough information so as not to bore anyone. I have a model that creates a user, which has various properties including an array of specializations: public class User { ... public string[] specializations { get;…
Connie DeCinko
  • 996
  • 5
  • 19
  • 39
0
votes
1 answer

Will this cancel an ExecuteReaderAsync

If I make a CancellationTokenSource and pass it down to a place where I perform a query like this: await command.Connection.OpenAsync(); dataReader = await command.ExecuteReaderAsync(_cancellationToken); If immediately below this I add the…
endyourif
  • 2,186
  • 19
  • 33
0
votes
0 answers

c# mysql: datareader.read always returns false

i'm just trying to retrieve the column names of a table in a database. the SQL query i've written (which works in phpMyAdmin) is: query = "SELECT column_name FROM information_schema.columns WHERE table_schema='hf_framework' AND…
4mla1fn
  • 169
  • 1
  • 15
0
votes
0 answers

While debugging read all values from an odbcdatareader query

We want to read the values from "answer" while we are in debug mode in visual studio without taking them with getValues function, just for debug. Is there any property shown in the local variable section where we can see the values? Dim conex As…
0
votes
1 answer

System.InvalidOperationException: ExecuteReader requires an open and available connection. The connection's current state is closed

I am having a problem with a customer service module which is in a different solution. the problem I think is in my method of calling or getting a connection here is my class called DBConnForAccess Imports System.Data.OleDb Imports…
Kym NT
  • 670
  • 9
  • 28
0
votes
3 answers

Reading value from database

I am trying to read a single entry from a database based on a parameter being passed into my function. I know the connection string is working as I use it elsewhere and my SQL statement works as I can execute it in SQL Server with no problem. The…
Ethel Patrick
  • 885
  • 7
  • 18
  • 38
0
votes
1 answer

How can I use executereader for different variables?

I use ExecuteScalar for single query like this: try { OleDbConnection Connection; using (Connection = new OleDbConnection("Provider=MSDAORA.1;Data Source=DATABASE:1521/orcl;Persist Security Info=True;Password=PASSWORD;User ID=USERNAME")) …
onur
  • 5,647
  • 3
  • 23
  • 46
0
votes
2 answers

Command.ExecuteNonQuery(); Error: Incorrect syntax near '='

My query is perfect (I have verified it in SQL Server Management Studio). My code is perfect, still I am getting this syntax error: Incorrect syntax near '='. Description: An unhandled exception occurred during the execution of the current web…
AlexR
  • 1
  • 1
0
votes
1 answer

Getting Timeout on stored procedure call

I have a stored procedure which works fine when executed manually but when it is called on the code it return a Null Reference Exception because of a TimeOut. Here's the code: private DataTable GetProcedure(DateTime dtStart, DateTime dtEnd) { …
Miquel Coll
  • 759
  • 15
  • 49
0
votes
1 answer

Query between two tables

This is my query with 2 parameters. Can someone please help me? sql = "select * from studentlist where firstname like '%" & Transaction.SEARCHSTUDENT.Text & "%' or studentnum like '%" &…
1 2 3
8 9