"INSERT INTO ROLES (UserId,GroupId) SELECT UserId,GroupId FROM Users, Groups WHERE username= '" + TextBox1.Text + "' AND rolename='" + TextBox2.Text + "'";
FYI, Please don't write code link this, This will create SQL Injection in your application. Use Command Parameter instead.
Just for your reference :
Introduction to SQL Injection[
^]