The code looks pretty ok, its strange that the row aint being inserted in the table.
However, u might want to debug by catching an int variable as return when the insert statement takes place and alert a message when the return value is greater than 0.
have a look at the below code:
public int InsertName(string xname)
SqlCommand cmd = new SqlCommand("Insert into Sample.dbo.tblName values('" + xname + "')", xconn);
ret = cmd.ExecuteNonQuery();
and on the click of a button or any other event the code will be like below:
private void btnAdd_Click(object sender, EventArgs e)
DataBaseLayer obj = new DataBaseLayer();
if (param > 0)
MessageBox.Show("your name has been saved..you can now go to the main page");
NewForm obj2 = new NewForm();
Try to debug like this, you might find whether the insert statement is actually executing or not.
Hope it helps.