7 Replies - 564 Views - Last Post: 28 April 2014 - 06:45 AM Rate Topic: -----

#1 x-bono  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-April 14

Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:15 AM

bonjour à tous
SVP j'ai un probleme pour connecter ma base de donneés postgresql à mon application C chap
j'ai essyer avec ce code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Npgsql;
namespace connect_to_postgres
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword
            NpgsqlConnection cnx = new NpgsqlConnection("Server=127.0.0.1;Port=5433;Database=postgis_21_sample;User Id=postgres;Password=weonewe");
            try
            {
                cnx.Open();
                MessageBox.Show("base connceter");
                cnx.Close();

            }
            catch
            {
                MessageBox.Show("base non connceter");
            }
         }
    }
}


mais il me donne cet erreur
*dans la fenétre d'execution :
Une exception de première chance de type 'System.IO.FileLoadException' s'est produite dans connect to postgres.exe
*dans un msgbox :
Impossible de charger le fichier ou l'assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' ou une de ses dépendances. Accès refusé.
Merci d'avance pour m'avoir aider

This post has been edited by Skydiver: 28 April 2014 - 06:22 AM
Reason for edit:: Put code in code tags. Please learn to do this yourself.


Is This A Good Question/Topic? 0
  • +

Replies To: Connect ma base de données postgresql à C chap

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,263
  • Joined: 05-May 12

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:24 AM

Nous parlons anglais dans ce forum.
Was This Post Helpful? 0
  • +
  • -

#3 x-bono  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-April 14

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:27 AM

je travail sur W7
Was This Post Helpful? 0
  • +
  • -

#4 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 362
  • View blog
  • Posts: 1,534
  • Joined: 08-April 09

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:29 AM

Google traduction pour nous dire en bref ce que vous voulez faire.
Thank you google translate.
Was This Post Helpful? 0
  • +
  • -

#5 x-bono  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-April 14

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:35 AM

thank you
indeed I am preparing for my final project study
from the thing that is needed in my project is to connect my database in vb.net postgrsql
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3616
  • View blog
  • Posts: 11,263
  • Joined: 05-May 12

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:39 AM

You probably need the binaries that are compiled for Windows rather than for Mono based on that error message you posted.
Was This Post Helpful? 0
  • +
  • -

#7 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 362
  • View blog
  • Posts: 1,534
  • Joined: 08-April 09

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:40 AM

For postgreSQL check this
http://www.connectio...com/postgresql/
there is the npgsql/ section for the connection to you DB.
Plus what Skydiver said :)/>

This post has been edited by Michael26: 28 April 2014 - 06:44 AM

Was This Post Helpful? 0
  • +
  • -

#8 x-bono  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 28-April 14

Re: Connect ma base de données postgresql à C chap

Posted 28 April 2014 - 06:45 AM

I already use the term Standard
User ID = root, Password = myPassword; Host = localhost, port = 5432; Database = MyDatabase;
Pooling = true; Min Pool Size = 0, Max Pool Size = 100; Connection Lifetime = 0;
with my own information but do not have market
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1