1
votes

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

1
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
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
Also you can check the compiler error description and solution in more details here - Oleg Kyrylchuk
Replaced with System. Data•ConnectionState•Open; still getting same error - user8420153

1 Answers

0
votes
  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;