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

ExecuteReader in EntityFramework Takes 15 seconds to provide output But stored procedure returns response within 1 seconds

I have a API method which calls stored procedure to returns 3 dataset. I have used ExecuteReader to get the results from stored procedure ! Problem : Stored procedures returns data within 1 seconds, but the executeReader takes 15 t0 20 seconds to…
0
votes
2 answers

how to access the data from SQL Server which is in JSON format using ASP.NET WEB API controller

I have created a stored procedure in SQL Server which returns in json format ALTER PROCEDURE [dbo].[GetAllRoles] AS BEGIN SELECT * FROM dbo.roles FOR JSON PATH; END Output of this stored procedure: [ { "role_id": 101,…
0
votes
1 answer

Why is timeout occurring while executing a stored procedure in C# even after increasing the commandtimeout property?

I have a piece of code that executes stored procedure.i have given a "Waitfor Delay '00:05' " in the SP for the purpose of testing the timeout in my C# code wherein my commandtimeout is set for 10 mins. While debugging, after 20 seconds or so when…
Riya
  • 1
0
votes
2 answers

How to populate VB.NET multidimensional dropdownlist?

I am trying to initialize a dropdownlist in VB.NET but my dropdownlist is not populating any values. I want the DataTextField to be different from DataValues in the dropdownlist. Dropdownlist should display series of strings; DataValues should…
salvationishere
  • 3,461
  • 29
  • 104
  • 143
0
votes
0 answers

VB.NET How to use ExecuteReader well

Here is a code : Private Sub ComboBoxQC1L1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxQC1L1.SelectedIndexChanged Dim conn As New SqlConnection If conn.State = ConnectionState.Closed Then …
Coucouyou
  • 19
  • 5
0
votes
1 answer

How to write VB.NET multidimensional arraylist?

I am developing a VB.NET ASPX file which is currently working. But now it errors cause I added this one new input parameter which is a dropdownlist. The dropdownlist works properly now. Its source comes from a SQL DataReader. But hte problem is…
salvationishere
  • 3,461
  • 29
  • 104
  • 143
0
votes
2 answers

How to call the values ​of all the selections on the web page in C # asp.net

create procedure [dbo].[CountPermits] ( @CodeMelli nvarchar(50) ) AS BEGIN select count(PermitType) as AllPermit from dbo.Permit where CodeMelli=@CodeMelli select count(PermitType) as ColdPermit from dbo.Permit where CodeMelli=@CodeMelli and…
Abbas
  • 1
  • 2
0
votes
1 answer

How to change decimal separator in ExecuteReader c#

How to change decimal separator in string, e.g. in mnoz_obj item the returned value is 24,000 and I need to have 24.000. The values are from database to JSON. I tried ToString(new CultureInfo etc.) but this doesn't work. I expect that…
jenik2205
  • 445
  • 1
  • 5
  • 19
0
votes
2 answers

vb.net - problem in loging in

I use the following code in my login form. but it doesn't care about cases. Just like admin or Admin or whether ADmin as username can either login to my system when the real one is admin. these are my code: sql = "SELECT * FROM tblStaff WHERE…
Tepken Vannkorn
  • 9,648
  • 14
  • 61
  • 86
0
votes
0 answers

MySQL, C# - reader.Read() gives me Null reference exception

Please help. I encountered this when I updated my MySql Connector to 8.0.11 to be able to access a mySql database with charset utf8mb. Am I missing something? Do I have to update something else? I receive rows when I execute the stored procedure…
Kate Lastimosa
  • 169
  • 2
  • 15
0
votes
0 answers

Given key was not present in dictionary in MySql Select statement

My connection is as follow: string conString = "server = 10.10.76.150; user id = root1; port 3306; password = root1; charset = utf8"; MySqlConnection conn = new MySqlConnection(conString); conn.Open(); When I insert some data into table, values are…
Ehtesham
  • 3
  • 5
0
votes
2 answers

Returning multiple results from database query in C#

I have the following code on my C# WinForm, which builds a query and passes it and a parameter to a function that queries the PostgreSQL database: DataTable dt = ((DataTable)dgvCategories.DataSource); List validationInfoResult = new…
marky
  • 4,878
  • 17
  • 59
  • 103
0
votes
1 answer

c# datatable row count returns 1 for empty table

I'm querying a SQL Server database and filling a datatable. But even when my sql returns no values, the datatable row count seems to be one. Here's my code: strSQL = "My sql string" cmd.CommandText = strSQL; cmd.Parameters.AddWithValue("@wsNo",…
buckshot
  • 315
  • 4
  • 15
0
votes
1 answer

VB.NET Executereader out of memory when switch to Chinese language

I have this code that works very well in different languages but when I change the regional setting number format to "Chinese Traditional" Out of memory exception happens on Executereader! What to do? Thank you! Dim dv As DataView Dim dt As…
Ehsan
  • 1
0
votes
0 answers

Understand & Reproduce ExecuteReader InvalidOperationException ("The connection's current state is open")

I have received a report from a user that they got this exception while using my application: ExecuteReader requires an open and available Connection. The connection's current state is open. | System.InvalidOperationException …
komodosp
  • 3,316
  • 2
  • 30
  • 59
1 2 3
8 9