Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0,

0

I am working on an asp.net c# application to connect with postgresql. I have PC which is Windows 7 32 bit. First i installed Postgresql version postgresql-10.14-1-windows on my PC. Then i tried to insert data into postgresql from c# window application. For this i added a reference of "Npgsql.dll" and "System.ValueTuple.dll" to project and tried following code

var cs = "Host=localhost;Username=testuser;Password=test12345;Database=test;";
            using (NpgsqlConnection connection = new NpgsqlConnection(cs))
            {
                
                //connection.ConnectionString = ConfigurationManager.ConnectionStrings["constr"].ToString();
                //connection.ConnectionString = cs;
                connection.Open();
                NpgsqlCommand cmd = new NpgsqlCommand();
                cmd.Connection = connection;
                cmd.CommandText = "Insert into employee values(@ID,@Fname,@Lname,@Email)";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new NpgsqlParameter("@ID", Convert.ToInt32(txtEmpID.Text)));
                cmd.Parameters.Add(new NpgsqlParameter("@EmpName", txtEmpName.Text));
                cmd.Parameters.Add(new NpgsqlParameter("@Email", txtEmpEmail.Text));
                cmd.Parameters.Add(new NpgsqlParameter("@Phone", txtEmpPhone.Text));
                cmd.ExecuteNonQuery();
                cmd.Dispose();
                connection.Close();
                txtEmpEmail.Text = "";
                txtEmpName.Text = "";
                txtEmpID.Text = "";
                txtEmpPhone.Text = "";
                lblmsg.Text = "Data Has been Saved";
            }

but when i tried to run it is giving Error

{"Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, 
 PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not 
 match the assembly reference. (Exception from HRESULT: 0x80131040)":"System.ValueTuple, Version=4.0.3.0, 
 Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"}

at the position

 using (NpgsqlConnection connection = new NpgsqlConnection(cs))

I Tried a lot to solve it out but i am very new to postgresql to could not found the solution. Kindly help me here.

c#
postgresql
asked on Stack Overflow Aug 29, 2020 by Sunny Sandeep

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0