1

The 'ConnectionState' exists in both 'System.Data.Common, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

bool flag2 = this.sqlite_conn.State != ConnectionState.Open;
            if (flag2)
            {
                this.sqlite_conn.Close();
                this.sqlite_conn.Open();
            }

Getting above error in this line of code while using dnspy. Error code is CS0433 from main.cs

user8420153
  • 11
  • 1
  • 3
  • Btw, what are you trying to achieve by this line of code `this.sqlite_conn.State != ConnectionState.Open;`? Close the connection? I think this can not compile. What about `this.sqlite_conn.Close();`? – Tomas Paul Apr 16 '20 at 19:45
  • The error says, that the type `ConnectionState` is in two assemblies. Try specify assembly you want to use. I guess it can be `this.sqlite_conn.State != System.Data.ConnectionState.Open;` – Oleg Kyrylchuk Apr 16 '20 at 21:08
  • Also you can check the compiler error description and solution in more details [here](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0433) – Oleg Kyrylchuk Apr 16 '20 at 21:16
  • Replaced with System. Data•ConnectionState•Open; still getting same error – user8420153 Apr 18 '20 at 05:53

1 Answers1

0
  1. Check your project references and using statements and remove any unused ones.
  2. Try to explicitly put the proper namespace in front of your enum, like:

    System.Data.ConnectionState.Open;

Tomas Paul
  • 490
  • 5
  • 13