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
4 answers

ExecuteReader, Adding Values to List, index out of range

Hello I have following code: SqlCeCommand commandArbeitstage= new SqlCeCommand("select count(IDStundensatz) as Gesamt from tblstunden Where IDPersonal = @IDPersonal Group by datepart(month, Datum) Order By datepart(month, Datum)", verbindung); …
0
votes
2 answers

VB.NET, Two SQL command, build a string

Im coding a programm with VB.NET (2010), which works with a local database(.sdf - SQL Server CE). Now, I need to execute two SELECT command. Here an example to understand what I want: SQL command example 1: SELECT A FROM tbl_Name If I read this…
Bk_
  • 99
  • 9
0
votes
2 answers

vb net store multiple datareader results into one string variable

i have a query like SELECT ITEM FROM DETAIL WHERE TID="1". that will return the results like m4, c1, f2, d5, k2 i'm using DATAREADER to get the multiple value results and here's the code Dim res as string = "SELECT ITEM FROM DETAIL WHERE…
Soni Gunz
  • 135
  • 5
  • 17
0
votes
1 answer

No value given for one or more required parameters dr=ExecuteReader()

private void PopuniListu(){ listBox1.Items.Clear(); conn = new OleDbConnection(connString); conn.Open(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT Imeiprezimeautora FROM…
0
votes
1 answer

.executenonquery() error No value given for one or more required parameters

Imports System.Data.OleDb Public Class LoginForm Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\User\Desktop\thesis\YBIM.accdb" Dim conn As New OleDbConnection ' TODO: Insert code to perform custom…
0
votes
1 answer

Does ExecuteReader(timeout) method terminate process and close connection?

When using ExecuteReader(timeout) method to execute a SP, does it terminate process and close connection?
Phillip
  • 141
  • 8
0
votes
1 answer

ExecuteReader Date data type in SQL showing issue

Hello guys I have this code, I have issue when I execute: zodjdate.Text = precti.GetDataTypeName(24); or zpridate.Text = precti.GetDataTypeName(23); It only shows date in that textBox. I would like to know if there is any way it can show the full…
Marek
  • 3,555
  • 17
  • 74
  • 123
0
votes
2 answers

vshost.exe has stopped working on ExecuteReader

I have problem when I'm trying to run my program, When I was on my first loop, it worked, but on the second loop "vshost.exe has stopped working" error was shown, when I debugged it the error was on my ExecuteReader(). can somebody please help me…
JanMichael
  • 31
  • 1
  • 12
0
votes
1 answer

SELECT into Array

I use ExecuteReader(). It returns only the last result. I wanted to display the result like an array in tbid_1.Text, tbid_1.Text, tbid_1.Text etc. public void Select(FrmVIRGO frm) { string query = "SELECT* FROM…
Prasetyo Jean
  • 57
  • 2
  • 4
  • 10
0
votes
1 answer

Errors for SQL Server connection in asp server

In an asp server we are getting error for SQL Server after executing ExecuteScalar, ExecuteReader and ExecuteNonQuery like shown below. The error will only come sometimes, it's not seen always. So anyone know why does this error comes? How to solve…
IT researcher
  • 3,274
  • 17
  • 79
  • 143
0
votes
1 answer

executereader never return

i am using mysql via devart dotconnect. above code is part of the multithreaded class. public void DoQuery(ref Devart.Data.MySql.MySqlDataReader Dr, string QryStr) { lock (locker) { …
user182582
0
votes
1 answer

Storing ID from SQL result

Im running the following code to tell if a user excists on a database - standard stuff. Obviously once the code is run a boolean true or false will be returned if there is a result. If a result is found i want to store the ID of the said result. Can…
user1352057
  • 3,162
  • 9
  • 51
  • 117
0
votes
4 answers

SqDataReader closed issue in .net

i have created a function which executes query and returns SqlDataReader, now i am using that in another function work with the returned data, but i gets the error saying reader is already closed. here is the functions: public static SqlDataReader…
Abbas
  • 4,948
  • 31
  • 95
  • 161
-1
votes
1 answer

How do I get ExecuteReader() to efficiently add items to a List?

I have a button in the UI that reveals all remaining records in a table. To handle this, in my controller, I have a simple SQL SELECT * statement with a LIMIT and OFFSET. My ExecuteReader is currently returning my data from the SQL command, which I…
BoGoodSki
  • 123
  • 1
  • 4
  • 12
-1
votes
1 answer

VB.Net - ExecuteReader: CommandText property has not been initialized

I know there are some threads about this topic, but for some reason nothing of these things given there didn't work for me. So that is my code: Dim strAccSQL As String = "SELECT nUserNo FROM dbo.tUser WHERE sUserID='" & AccountID.Text & "';" …
Flainity
  • 3
  • 1
  • 5
1 2 3
8
9