Don't do it like that! Never 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.
There is also the likelihood that your INSERT is not working beause you don;t specify the fields:
cmd.CommandText = "insert into Table1 values('" + textBox1.Text + "','"+ gen +"')";
When you insert like this, SQL starts inserting values from the first column onward - which is dangerous, because if the columns get reordered for any reason, your code inserts into the wrong rows and either crashes, or worse fills your db with a mixture of valid and invalid data. Plus, if you have a row ID column which is an IDENTITY column say, they are generally the first column, and you can't set a value to them - SQL will complain if you try.
Always specify the fields, always use parameterised queries:
cmd.CommandText = "INSERT INTO Table1 (myColumn1, myColumn2) VALUES(@V1, @V2)"
cmd.Parameters.AddWithValue("@V1", textBox1.Text);
cmd.Parameters.AddWithValue("@V2". gen);