Hi @Mohamed Rafi N , welcome to Microsoft Q&A forum.
It seems the code snippet you provided have multiple issues.
First issue is related to 'The connection is already open'. This is because you are using cnn.Open() at multiple places in the code. Please remove it from top of code and have it at 2nd place.
Second issue is related to below line:
string query = "select * from login where userid=@userid,password=@password,confirmpassword=@confirmpassword where loginid=@loginid is same";
Please use below corrected line:
string query = "select * from login where userid=@userid and password=@password and confirmpassword=@confirmpassword and loginid=@loginid";
Please try this once and let me know if you face any other issue.
----------
If answer helps, please mark it 'Accept Answer'