Log

C# |Posgresql | Npgsql | connector | Could not load file or assembly 'System.Data.Common

Recommended Posts

Hello, I have a problem
--> Link <--


using Npgsql;
using GTANetworkAPI;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using System;

namespace Npgsql
{
    public class Main : Script
    {
        [Command("test")]
        public void Hello(Client client)
        {
            string conn_param = "Server=127.0.0.1;Port=5432;User Id=postgres;Password=**********;Database=postgresqlDB;";
            NpgsqlConnection conn = new NpgsqlConnection(conn_param);
            NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM players;", conn);
            conn.Open();
            NpgsqlDataReader reader;
            reader = com.ExecuteReader();
            while (reader.Read())
            {
                try
                {
                    string result = reader.GetString(1);
                    client.SendChatMessage(result);
                }
                catch { }

            }
            conn.Close();
        }
    }
}

I must say right away that he cannot find the library, I understand, the fact is that it is present.
If you add the file System.Data.Common in the folder from which the server is started, another error will appear.

--> Link <--

And add the file  System.Threading.tasks.extensions in the folder, Nothing happens.

 

 

 

Share this post


Link to post
Share on other sites

This might not be the answer you're looking for, but i'd use EntityFramework if i were you, saves you alot of time and works like a charm

Share this post


Link to post
Share on other sites

first of all, make sure you're using correct version of net-core , the next step, put ur resource dll files (specified in meta.xml) to resource directory, other files need to be placed to bridge/runtime folder

Share this post


Link to post
Share on other sites

As I understand it is related to Assembly versions.
If you can, prompt what versions you use.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.