locked
Please solve this simple error RRS feed

  • Question

  • User-252555582 posted

    if(cn.State!=connectionState.open)

    how to write this code when connecting to mysql server.

    my error:the name connectionstate does not exist in the current context.Cry

    Friday, November 7, 2014 5:10 AM

Answers

  • User-821857111 posted

    You need to include

    using System.Data;

    in your file. Note also that C# is case-sensitive.  ConnectionState has a capital C and S, and Open begins with a capital too.

    if(cn.State != ConnectionState.Open)



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 7, 2014 5:16 AM