Three things:
1) Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
2) It's a damn good idea to store connections strings in a configuration file, so they only need to be changed in one place, and your app doesn't need to be recompiled...
3) Your Button1 Click handler doesn't use the connection object "cn" it cretaed - so you get the error. Try creating the CMD object after the Connection:
Dim cn As New SqlConnection("Data Source=PRITHVI;Initial Catalog=Database2;Integrated Security=True")
cn.Open();
Dim Cmd = New SqlCommand(query, cn);