Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite: DbDataReader resets if called Read again after reader is finished #15879

Closed
smitpatel opened this issue May 31, 2019 · 0 comments · Fixed by #15881
Closed

Sqlite: DbDataReader resets if called Read again after reader is finished #15879

smitpatel opened this issue May 31, 2019 · 0 comments · Fixed by #15881
Assignees
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

using System;
using Microsoft.Data.Sqlite;

namespace SqliteDemo
{
    public class Program
    {
        public static void Main(string[] args)
        {
            using (var connection = new SqliteConnection("Data Source=:memory:"))
            {
                connection.Open();
                using (var createCommand = connection.CreateCommand())
                {
                    createCommand.CommandText =
                    @"CREATE TABLE Test (value INTEGER);
INSERT INTO Test VALUES(1);
INSERT INTO Test VALUES(2);
INSERT INTO Test VALUES(3);";
                    createCommand.ExecuteNonQuery();
                }

                using (var queryCommand = connection.CreateCommand())
                {
                    queryCommand.CommandText = "Select * from Test";
                    using (var dbreader = queryCommand.ExecuteReader())
                    {
                        while (dbreader.Read())
                        {
                            Console.WriteLine(dbreader.GetInt32(0));
                        }

                        Console.WriteLine(dbreader.Read());
                    }
                }
            }

            Console.WriteLine("Hello World!");
        }
    }
}

Version: 3.0.0-preview5.19227.1
Output:

PM> dotnet run
1
2
3
True
Hello World!
PM> 
@smitpatel smitpatel changed the title Sqlite: DbDataReader resets if called Read again again reader is finished Sqlite: DbDataReader resets if called Read again after reader is finished May 31, 2019
@bricelam bricelam self-assigned this May 31, 2019
@bricelam bricelam added this to the 3.0.0 milestone May 31, 2019
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 31, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants