an error keeping popping up in my codes (connection already open)

前端 未结 2 769
天涯浪人
天涯浪人 2021-01-29 10:16

This error keeps popping up!!! An unhandled exception of type \'System.InvalidOperationException\' occurred in MySql.Data.dll

Additional information: The connection is a

2条回答
  •  臣服心动
    2021-01-29 10:43

    It looks like you are not closing the connection after executing the query. You only have

    con.Open()
    

    and are not closing the connection after

    cmd.ExecuteNonQuery()
    

提交回复
热议问题