I can't see error in that code but I can see some bad practice.
I mean.
If you're using DataAdapter then no need to close connection, DataAdapter will be fully responsible for that.
Data Will be filled when you are calling
da.Fill(ds,"mydata");
After that Database connection will be closed. and you stated that "Database is now open" and Further you closed again connection which is already closed.
For safe side to close connection you should use.
if (con.State == ConnectionState.Open)
con.close();