npgsql

Using npgsql with EF6 in asp.net 5

社会主义新天地 提交于 2019-12-12 04:17:37
问题 Is there documentation as how to install npgsql supporting EF6 in asp.net 5 enviroment ? Or an example? 回答1: This blog post goes over using EF6 with ASP.NET 5. http://blog.tonysneed.com/2016/01/22/ef6-asp-net-core-mvc6/ In theory you just need to use https://www.nuget.org/packages/Npgsql.EntityFramework/. Use caution howerver: EF6 does not (and will not) support .NET Core, only the full .NET Framework. EF Core is a new version of EF, designed to support ASP.NET Core on .NET Core. Npgsql has

Encoding=ASCII; and Encoding=UNICODE; do not work in an Npgsql 3 connection string

烈酒焚心 提交于 2019-12-12 02:12:04
问题 I have a new install of PostgreSQL (9.6.1) using the Big SQL installer, and a new install of Npgsql (3.2.0) using the .msi installer, but non-ASCII character support seems to be broken. My connection string is: <add name="Northwind" connectionString="Database=Northwind;Server=localhost;Port=5432;User Id=postgres;Password=123;Encoding=ASCII;" providerName="Npgsql"/> I get exception messages like this, when reading back non-ASCII character data: System.Text.DecoderFallbackException : Unable to

Errors with tables creation by code first model with npgsql

不羁的心 提交于 2019-12-12 00:43:37
问题 Problem with tables creation by code first model with npgsql Database creation should work from version 2.2.0-beta1: «David Karlaš added support for EFMigration and Database creation in EF6+ Now it is possible to start Code First projects without needing to create a database upfront. EntityFramework and Npgsql will take care of it. Emil Lenngren added support for a lot of missing features of EntityFramework.» https://www.nuget.org/packages/Npgsql/2.2.0-beta1 But, when I tried to do this I

Where (or how) should I define the schema in a select statement when using PostgreSQL?

六月ゝ 毕业季﹏ 提交于 2019-12-11 22:53:48
问题 I have an application built upon ASP.NET 3.5 and PostgreSQL 8.3. My database has 3 users, a data owner (xxx-owner), a data editor (xxx-editor), and a data viewer (xxx-viewer). Each user has their own schema called xxx-schema, xxx-editor-schema and xxx-viewer-schema. All the data is stored in xxx-schema. This requires that I specify the schema when connecting to the database as either the xxx-editor or xxx-viewer users as shown in the following snippet. NpgsqlCommand pgCommand = new

Update doesn't work from datagridview using npgsql

邮差的信 提交于 2019-12-11 19:46:42
问题 I am having problem updating my data through datagridview using Npgsql. I want update my table dynamically from datagridview. Here is my code to update : NpAdapter.UpdateCommand = new NpgsqlCommand("update sessions set \"Visit Number:\" = :visit_num, \"ID:\" = :id, \"ENTERED BY:\" = :entered " + "where \"Visit Number:\" = :visit_num_old, \"ID:\" = :id_old, \"ENTERED BY:\" = :entered_old", this.dataconnect); NpAdapter.UpdateCommand.Parameters.Add(new NpgsqlParameter("visit_num", DbType.Int32,

PostgreSQL with EntityFramework in MonoDevelop on Ubuntu

爱⌒轻易说出口 提交于 2019-12-11 18:26:36
问题 I tried to configure a project in MonoDevelop on Ubuntu, to use EntityFramework with Npgsql provider, by following official steps. However, something seem to be wrong with that suggested configuration file (or I'm missing something), as I can't get rid of this error: The Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql.EntityFrameworkLegacy, Version=2.1.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' registered in the application config file for the ADO.NET provider with

What NpgsqlDbType should be used to clear “Can't write CLR type” error

假如想象 提交于 2019-12-11 13:32:08
问题 I am using PostgreSQL as my database. I have an application that is written in ASP.NET C# WebForms Using Npgsql with PostgreSQL I have table named tblAppt in my database, in that table I have a column named appttime that column's Data type is time without time zone In pgAdmin4's Query Tool if I run the following query: INSERT INTO tblAppt (appttime) VALUES ('00:30:00'); The results are: INSERT 0 1 Query returned successfully in 105 msec. Which means the record was added in my table, in the

What is the Date type in npgsql?

霸气de小男生 提交于 2019-12-11 13:30:03
问题 I am using postgreSQL database. I need to add "Date" parametres with SQL query. What do I have to write where I wrote in the code "XXX" Here is the source code: NpgsqlCommand RupCmd = new NpgsqlCommand("UPDATE TABLE SET dat1=@dno,dat2=@dlidz,id_viesis=@idv,id_istaba=@idi WHERE rezervacijas_id=@id", con); RupCmd.Parameters.Add(new NpgsqlParameter("@dno", NpgsqlTypes.NpgsqlDbType.Date, XXX, "dat1")); RupCmd.Parameters.Add(new NpgsqlParameter("@dlidz", NpgsqlTypes.NpgsqlDbType.Date, XXX, "dat2")

how to deploy npgsql on Raspberry pi 2 (Mono 4 + ARM proc)?

廉价感情. 提交于 2019-12-11 13:03:11
问题 I use Visual studio 2013 (Windows) to build a small .NET 4.5 application using Npgsql and Entity Framework 6. On windows it just works fine. But on Raspbian, the app crash saying it cannot find npgsql provider. Unhandled Exception: System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider 'Npgsql'. at System.Data.Common.DbProviderFactories.GetFactory (System.String providerInvariantName) [0x00000] in <filename unknown>:0 [...] On my

PostgreSQL equivalent to SQL Server's TVP

不羁岁月 提交于 2019-12-11 11:08:46
问题 SQL Server has Table Value Parameters which allows you to pass an array of values as a parameter. What is the appropiate way to achieve something similar to a PostgreSQL query so I can do something like: select * from product where id in ($1) I'm using Npgsql .NET library. https://www.nuget.org/packages/Npgsql/3.0.5 回答1: In PostgreSQL you can use arrays instead of list of IDs like: ... where id = any('{1, 2, 3}'::int[]) or ... where id = any(array[1, 2, 3]) which means that id is one of the