First of all, I can erase your db by trying to log in. Read up on SQL injection. Second, you need a data layer. Then you need to use try/finally blocks to make sure all DB connections get closed and disposed of. Once you do this, the error will go away, the issue is that your connection has not been closed from a previous action.
Keeping a DB connection open for the life time of your app is also part of your problem.
I found the issue. If you told us what line had the issue, I'd have found it the firs time. Your code is really bad and you have no idea what you're doing. Buy a book.
x = txtpass.Text;
string y = CreateHash(x);
string query = "insert into login values ('" + txtuser.Text + "','" + y + "')";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
MessageBox.Show("Inserted");
This code creates a new command, against the connection called con. The old command has not been closed, that's why you get the error. It means what it says, in plain english, and as you could see the line, that and google should have been enough. If it's not, then you have a long way to go before you can write code like this. Buy a book.