Forum Cross Platform with Xamarin


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Postgres SQL database connectivity?

I am working with company that primary develops most of their software in a system that uses Postgres SQL in PGAdmin. Is there a way to connect to this database in Xamarin cross platforms?

I've looked through libraries used in C# development (npgql, devart pgsql, etc) but none of those seem to work in a mobile platform. In addition to that, SQLite doesn't seem to support pgSQL.

Can anyone offer suggestion or help? Thanks.

Best Answer


  • I'm used to using this pattern for my PgSQL queries. Is there something to use that closely fits this layout? If not, what would be the best way to get this sort of functionality? I want to be able to enter in SQL statements on the fly

    using(var db = GetOpenDatabaseConnection()){ using(var cmd = db.CreateCommand()){ cmd.Parameters.AddWithValue("MyParameter", 12); cmd.CreateCommand [email protected]" SELECT * FROM mytable WHERE column = :MyParameter "; using(var dr = cmd.ExecuteReader()){ while(dr.Read()){ //assign objects values from result set } } } }

  • HalilDoganBolakHalilDoganBolak USMember ✭✭

    @LukeRockswold did you ever find a solution to implementing connectivity from Xamarin to PgSQL ?

  • LukeRockswoldLukeRockswold USMember

    @HalilDoganBolak said:
    @LukeRockswold did you ever find a solution to implementing connectivity from Xamarin to PgSQL ?

    You have to create a webservice using C# Web API or some other sort of RESTful service that sends JSON strings.

Sign In or Register to comment.