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
-1
votes
1 answer

ExecuteReader: Connection error message

I would like to display data in my text boxes and i have run across an error in my DAL. I have a stored procedure but i cannot get my data to return in the return value. I would like to use my BLL to return a DataTable. Please can you…
PriceCheaperton
  • 5,071
  • 17
  • 52
  • 94
-1
votes
1 answer

Best way sending ExecuteReader result over http

What is the best way, sending the result of ADO.NETs ExecuteReader over http to an client (the client pulls the data of course). I don't want to load the result into an List> serialize it and so on, becuase this seems to…
BendEg
  • 20,098
  • 17
  • 57
  • 131
-1
votes
1 answer

How to execute a stored procedure containing INSERT and SELECT both statements

In my stored procedure, first i do INSERT query and then have SELECT statement as follow: INSERT () SELECT * FROM preferences WHERE ID=@ID In ADO.NET, i have used - datareader to execute this procedure. But, it does not return the…
user3711357
  • 1,425
  • 7
  • 32
  • 54
-1
votes
2 answers

Commandobject.executenonquery() and Commandobject.executereader() give different results for count(*)

I'm trying to create a login page and when i give executereader it works and when i give executenonquery it returns a -1 value instead of 1. This return -1 on cmd.executenonquery() SqlCommand cmd = new SqlCommand("select Count(*) from userDb where…
Sainath
  • 979
  • 2
  • 13
  • 22
-2
votes
1 answer

Cannot implicity convert type error

Trying to fill Combobox with data from a database and I'm using ExecuteReader as below, but when I try to instantiate my connection it shows me the error Cannot implicitly convert type error My DBConnect class code: public class DBConnect { …
-3
votes
1 answer

not able to load odbcdatareader to a datatable

I am using an Informix db, and I am trying to get data for a specific item and store it in a datatable. I checked the following: 1) connection string looks good 2) the connection is able to open 3) I used the same connection string from the…
CodeMan
  • 133
  • 3
  • 19
-3
votes
2 answers

System.InvalidOperationException: ExecuteReader: Connection property has not been initialized

protected void Button3_Click(object sender, EventArgs e) { cn.Open(); SqlCommand cmd = new SqlCommand("select top '"+Label4.Text+"' * from qb_vb where marks=1"); SqlDataReader dr1 = cmd.ExecuteReader(); if (dr1.Read()) { Label8.Text =…
Prabhdeep Bhatia
  • 144
  • 1
  • 2
  • 10
-4
votes
1 answer

Why is this SqlCeCommand ExecuteReader call failing?

I adapted my code below from "Microsoft .NET Compact Framework" by Wigley and Wheelwright: SqlCeConnection cn = new SqlCeConnection(@"Data Source=\My Documents\Traffic.sdf"); String sSQL= "SELECT CarID, Reg, Location FROM Cars"); SqlCeCommand…
1 2 3
8
9