ado.net

SQLite: How do I connect to an in-memory, shared cache database?

旧城冷巷雨未停 提交于 2020-04-08 09:56:31
问题 I'm trying out the in-memory shared cache feature of SQLite 3.7.13, via the ADO.NET provider. The following connect string works, but yields a non-shared-cache db: Data Source=:memory: When I try any of these: Data Source=:memory:?cache=shared Data Source=file::memory:?cache=shared Data Source=file:x?mode=memory&cache=shared I get the following ArgumentException when opening a connection: Invalid ConnectionString format for parameter "Data Source" What should the connect string look like for

SQLite: How do I connect to an in-memory, shared cache database?

杀马特。学长 韩版系。学妹 提交于 2020-04-08 09:56:15
问题 I'm trying out the in-memory shared cache feature of SQLite 3.7.13, via the ADO.NET provider. The following connect string works, but yields a non-shared-cache db: Data Source=:memory: When I try any of these: Data Source=:memory:?cache=shared Data Source=file::memory:?cache=shared Data Source=file:x?mode=memory&cache=shared I get the following ArgumentException when opening a connection: Invalid ConnectionString format for parameter "Data Source" What should the connect string look like for

Get all column valus of a datatable based on only one distinct column [duplicate]

柔情痞子 提交于 2020-03-05 05:38:05
问题 This question already has answers here : How to select distinct rows in a datatable and store into an array (18 answers) Closed 5 years ago . I have a table with 10 columns and I want to get all values of each row but only of distinct IDs. I have this so far: DataTable Distinct = view.ToTable(true, "ID"); But this creates a DataTable that only contains the ID column. I want a DataTable with distinct ID's but containing all column values(there can be duplicates for the other columns.) Is there

Setting fetch size in entity framework

流过昼夜 提交于 2020-02-24 11:15:29
问题 I am converting ado.net code to use EF. In my ado.net code i set dataReader.FetchSize = command.RowSize * 1000 and that dramatically improves performance over the default fetch size . When I convert my code to EF, the performance is on par to ado.net code where I didn't specify fetch size, i.e. it's very slow over large records. Any way I could specify fetch size for retrieving records in EF? 回答1: You can set ODP.NET FetchSize in the Registry or the .NET config files when using Entity

Fate of an ADO.Net Transaction when connection is suddenly broken

久未见 提交于 2020-02-15 08:30:42
问题 Consider the sample code below. If the connection to the database is suddenly broken when on STEP 2 (i.e. 2nd command), then even if we try to rollback the transaction it will not rollback since there is no connection to the database server. In such a case, what happens to the transaction object on the database server side? Will it remain in a waiting mode? I have had this situation come up when I tried to run a long transaction in ADO.Net by connecting to database servers through a VPN

Fate of an ADO.Net Transaction when connection is suddenly broken

纵然是瞬间 提交于 2020-02-15 08:28:26
问题 Consider the sample code below. If the connection to the database is suddenly broken when on STEP 2 (i.e. 2nd command), then even if we try to rollback the transaction it will not rollback since there is no connection to the database server. In such a case, what happens to the transaction object on the database server side? Will it remain in a waiting mode? I have had this situation come up when I tried to run a long transaction in ADO.Net by connecting to database servers through a VPN

Building Project that uses EntityFramework fails with a lot of errors

无人久伴 提交于 2020-02-07 17:08:49
问题 I am using EntityFramework as my Data Access Layer in a Visual Studio C# project. I have added a new entity model and built right away without adding or doing anything to test its functionality. Unfortunately, the build failed with many errors like: CS0426 The type name 'Data' does not exist in the type 'System' CS0138 A 'using namespace' directive can only be applied to namespaces; 'System' is a type not a namespace. Consider a 'using static' directive instead CS0246 The type or namespace

Building Project that uses EntityFramework fails with a lot of errors

随声附和 提交于 2020-02-07 17:08:10
问题 I am using EntityFramework as my Data Access Layer in a Visual Studio C# project. I have added a new entity model and built right away without adding or doing anything to test its functionality. Unfortunately, the build failed with many errors like: CS0426 The type name 'Data' does not exist in the type 'System' CS0138 A 'using namespace' directive can only be applied to namespaces; 'System' is a type not a namespace. Consider a 'using static' directive instead CS0246 The type or namespace

Sql Connection Error 40 Under Load

前提是你 提交于 2020-02-07 05:13:15
问题 My database connections from my web servers work fine normally, but when a write heavy windows service I have triggers, I will randomly get "A network-related or instance-specific error occurred while establishing a connection to SQL Server. Error 40." from my webservers. I have tried turning connection pooling off for my web servers since they share the same connection string as the windows service, but I am at a loss as to what is still causing this. My SqlConnection objects are all wrapped

Sql Connection Error 40 Under Load

六月ゝ 毕业季﹏ 提交于 2020-02-07 05:12:53
问题 My database connections from my web servers work fine normally, but when a write heavy windows service I have triggers, I will randomly get "A network-related or instance-specific error occurred while establishing a connection to SQL Server. Error 40." from my webservers. I have tried turning connection pooling off for my web servers since they share the same connection string as the windows service, but I am at a loss as to what is still causing this. My SqlConnection objects are all wrapped